<template>
  <section class="main">
    <div class="title">
      <span>基本信息</span>
      <div>
        <el-button icon="el-icon-edit" @click="altermerchants()">修改</el-button>
        <el-button icon="el-icon-refresh"></el-button>
      </div>
    </div>
    <div class="container">
      <div class="itemBox">
        <div class="line">
          <div>商户名</div>
          <div>{{merchantinfo.merchantName}}</div>
        </div>
        <div class="line">
          <div>商户号</div>
          <div>{{merchantinfo.merchantNo}}</div>
        </div>
        <div class="line">
          <div>商户简称</div>
          <div>{{merchantinfo.merchantShortName}}</div>
        </div>
        <div class="line">
          <div>注册名称</div>
          <div>{{merchantinfo.merchantBusinessName}}</div>
        </div>
        <div class="line">
          <div>商户地址</div>
          <div>{{merchantinfo.merchantAddress}}</div>
        </div>

      </div>
      <div class="itemBox">
        <div class="line">
          <div>商户负责人</div>
          <div>{{merchantinfo.contactName}}</div>
        </div>
        <div class="line">
          <div>负责人电话</div>
          <div>{{merchantinfo.contactPhone}}</div>
        </div>
        <div class="line">
          <div>负责人邮箱</div>
          <div>{{merchantinfo.contactEmail}}</div>
        </div>
        <div class="line">
          <div>客服电话</div>
          <div>{{merchantinfo.servicePhone}}</div>
        </div>
      </div>
      <div class="itemBox">
        <div class="line">
          <div>一级服务商</div>
          <div>{{merchantinfo.agent1Name}}</div>
        </div>
        <div class="line">
          <div>二级服务商</div>
          <div>{{merchantinfo.agent2Name}}</div>
        </div>
        <div class="line">
          <div>业态</div>
          <div>{{merchantinfo.bdName}}</div>
        </div>
        <div class="line">
          <div>所属行业</div>
          <div>{{merchantinfo.merchantMccName}}</div>
        </div>
      </div>
    </div>
    <!-- 结算信息 -->
    <div class="title">
      <span>结算信息</span>
      <!-- <div>
        <el-button icon="el-icon-edit"></el-button>
        <el-button icon="el-icon-refresh"></el-button>
      </div> -->
    </div>
    <div class="container">
      <div class="itemBox">
        <div class="line">
          <div>账户类型</div>
          <div>{{merchantinfo.accountTypeName}}</div>
        </div>
        <div class="line">
          <div>开户名</div>
          <div>{{merchantinfo.accountCardName}}</div>
        </div>
      </div>
      <div class="itemBox">
        <div class="line">
          <div>银行预留手机号</div>
          <div>{{merchantinfo.accountPhone}}</div>
        </div>
        <div class="line">
          <div>开户证件号</div>
          <div>{{merchantinfo.principalCertNo}}</div>
        </div>
      </div>
      <div class="itemBox">
        <div class="line">
          <div>开户账号</div>
          <div>{{merchantinfo.accountCardNum}}</div>
        </div>
        <div class="line">
          <div>开户支行</div>
          <div>{{merchantinfo.accountBankName}}</div>
        </div>
      </div>
    </div>
    <!-- 通道信息 -->
    <div class="title">
      <span>通道信息</span>

    </div>
    <div class="container">
      <div class="itemBox">
        <div class="line" v-if="alichannelboxinfo.alimchId">
          <div>{{alichannelboxinfo.alichannelName}}通道商户号</div>
          <div>{{alichannelboxinfo.alimchId}}</div>
        </div>
        <div class="line" v-if="wxchannelboxinfo.wxmchId && wxchannelboxinfo.wxmchId != alichannelboxinfo.alimchId">
          <div>{{wxchannelboxinfo.wxchannelName}}通道商户号</div>
          <div>{{wxchannelboxinfo.wxmchId}}</div>
        </div>
      </div>
      <div class="itemBox">
        <div class="line">
          <div>微信子商户号</div>
          <div>{{wxchannelboxinfo.wxziMchId}}</div>
        </div>
      </div>
      <div class="itemBox">
        <div class="line">
          <div>支付宝子商户号</div>
          <div>{{alichannelboxinfo.aliziMchId}}</div>
        </div>
      </div>

    </div>
    <!-- 支付 -->
    <div class="title" v-if="merchantinfo.status== 0 || merchantinfo.status == 98 || merchantinfo.status == 10">
      <span>支付</span>
      <div>
        <el-button v-if="userinfo.rolesId == 1 || userinfo.rolesId == 8" type="primary" @click="jurisdiction = true">权限配置</el-button>
      </div>
    </div>
    <div class="container" v-if="merchantinfo.status== 0 || merchantinfo.status == 98 || merchantinfo.status == 10">
      <div class="payBox">
        <div class="thead">
          <span>支付方式</span>
          <span>支付通道</span>
          <span>支付配置</span>
          <span>费率配置</span>
          <span>结算周期</span>
          <span v-if="userinfo.rolesId == 1 || userinfo.rolesId == 8">营销活动</span>
          <span>其他配置</span>
        </div>
        <div class="tbody">
          <div>微信</div>
          <div>
            {{merchantinfo.wxChannelName}}
            <i class="el-icon-sort" @click="changechannelBox('1')"></i>
          </div>
          <div>
            <span class="bule" @click="wecharpayset('1')">设置</span>
          </div>
          <div>
            <div class="wid50">{{splice(merchantinfo.wxChannelRate)}}‰&nbsp;</div>
            <span class="bule" @click="rateBtn('wx')">设置</span>
          </div>
          <div>
            {{merchantinfo.wxSettlement}}
            <i class="el-icon-sort" v-if="userinfo.rolesId == 1 || userinfo.rolesId == 8" @click="SettlementBtn('1')"></i>
          </div>
          <div v-if="userinfo.rolesId == 1 || userinfo.rolesId == 8">
            <!-- 绿洲  
            <el-switch
              v-model="wecharlvzhou"
              @change="lvzhou(merchantinfo.wxChannelId)"
              >
            </el-switch> -->
          </div>
          <div>
            <div class="bule" style="width:100%" @click="applistBtn"><span>微信关注配置</span></div>
            <div class="bule" style="width:100%" @click="wxminiprogrambtn"><span>微信小程序配置</span></div>
          </div>
        </div>
        <div class="tbody">
          <div>支付宝</div>
          <div>
            {{merchantinfo.aliChannelName}}
            <i class="el-icon-sort" @click="changechannelBox('2')"></i>
          </div>
          <div>
            <span class="bule" @click="wecharpayset('2')">设置</span>
          </div>
          <div>
            <div class="wid50">{{splice(merchantinfo.aliChannelRate)}}‰&nbsp;</div>
            <span class="bule" @click="rateBtn('ali')">设置</span>
          </div>
          <div>
            {{merchantinfo.aliSettlement}}
            <i class="el-icon-sort" v-if="userinfo.rolesId == 1 || userinfo.rolesId == 8" @click="SettlementBtn('2')"></i>
          </div>
          <div v-if="userinfo.rolesId == 1 || userinfo.rolesId == 8">
            <!-- <el-button v-if="alilanhaival == 0" type="primary" round @click="newlanhaibtn">新蓝海(未开通)</el-button>
            <el-button v-else-if="alilanhaival == 1"  type="warning" round>新蓝海(审核中)</el-button>
            <el-button v-else-if="alilanhaival == 2" type="success" round>新蓝海(已开通)</el-button>
            <el-button v-else-if="alilanhaival == 4" type="danger" round @click="newlanhaibtn()">新蓝海(已驳回)</el-button> -->
          </div>
          <div>
            <div class="bule" style="width:100%" @click="aliBoxs">支付宝授权配置</div>
            <!-- <div class="operbtn" style="width:100%;color:#6f2fea;" @click="threebinding = true" >代运营申请</div>
            <div class="operbtn" style="width:100%;color:#000fd8; margin:5px 0" @click="operationresult()">同步运营操作结果</div>
            <div class="operbtn" style="width:100%;color:rgb(0 156 216)" @click="syncShop()">同步支付宝门店</div> -->
            <div class="operbtn" style="width:100%;color:#000fd8;" @click="threebinding = true">代运营配置</div>
          </div>
        </div>
        <div class="tbody" v-if="merchantinfo.uniChannelId">
          <div>云闪付</div>
          <div>
            {{merchantinfo.uniChannelName}}
            <i class="el-icon-sort" @click="changechannelBox('3')"></i>
          </div>
          <div>
            <span class="bule"></span>
          </div>
          <div>
            <div class="marv">
              <span>贷记卡>1000的费率</span>
              <div class="wid50-2" v-if="merchantinfo.uniChannelRate">{{merchantinfo.uniCreditGt1000Rate/10}}‰&nbsp;</div>
              <!-- <span class="bule" @click="rateBtn('uni')">设置</span> -->
            </div>
            <div class="marv">
              <span>贷记卡≤1000的费率</span>
              <div class="wid50-2" v-if="merchantinfo.uniChannelRate">{{merchantinfo.uniCreditLe1000Rate/10}}‰&nbsp;</div>
              <!-- <span class="bule" @click="rateBtn('uni')">设置</span> -->
            </div>
            <div class="marv">
              <span>借记卡≤1000的费率</span>
              <div class="wid50-2" v-if="merchantinfo.uniChannelRate">{{merchantinfo.uniDebitGt1000Rate/10}}‰&nbsp;</div>
              <!-- <span class="bule" @click="rateBtn('uni')">设置</span> -->
            </div>
            <div class="marv">
              <span>借记卡>1000的费率</span>
              <div class="wid50-2" v-if="merchantinfo.uniChannelRate">{{merchantinfo.uniDebitLe1000Rate/10}}‰&nbsp;</div>
              <!-- <span class="bule" @click="rateBtn('uni')">设置</span> -->
            </div>
          </div>
          <div>
          <!-- 结算周期预留位子 -->
          </div>
          <div v-if="userinfo.rolesId == 1 || userinfo.rolesId == 8">

          </div>
          <div class="bule"></div>
        </div>
        <div class="tbody">
          <div>银行卡</div>
          <div>
            <!-- {{merchantinfo.aliChannelName}}
            <i class="el-icon-sort"></i>-->
          </div>
          <div>
            <span class="bule" @click="banks = true;">设置</span>
          </div>
          <div>
            <div class="wid50">
              信用卡/{{(merchantinfo.creditcardProfitRate/10).toFixed(2)}}‰
              <br>
              储蓄卡/{{(merchantinfo.debitcardProfitRate/10).toFixed(2)}}‰封顶:{{(merchantinfo.debitcardTopFee/100).toFixed(2)}}元
            </div>
            <span class="bule" @click="cost = true">设置</span>
          </div>
          <div>
            <!-- <i class="el-icon-sort"></i> -->

          </div>
          <div v-if="userinfo.rolesId == 1 || userinfo.rolesId == 8"></div>
          <div class="bule"></div>
        </div>
      </div>
    </div>
    <!-- 通道 -->
    <div class="title" v-if="merchantinfo.status== 0 || merchantinfo.status == 98 || merchantinfo.status == 10">
      <span>通道</span>
      <div>
        <!-- <span class="bule">停用</span> -->
        <el-button v-if="userinfo.rolesId == 1 || userinfo.rolesId == 8" type="primary" @click="addchannelBtn()"><i class="el-icon-plus"></i>添加</el-button>
        <el-button v-if="oemFlag == 1 && oeminfo.channelConfigSwitch == 1" type="primary" @click="addchannelBtn()"><i class="el-icon-plus"></i>添加</el-button>
        <el-button icon="el-icon-refresh"></el-button>
      </div>
    </div>
    <div class="container channel" v-if="merchantinfo.status== 0 || merchantinfo.status == 98 || merchantinfo.status == 10">
      <div class="cBox" v-for="(item, index) in channelinfo" :key="index">
        <div :title="item.reviewedReason" class="channelitem">
          <div class="state" v-if="item.reviewedStatus == 1"><span>通过</span></div>
          <div class="review" v-if="item.reviewedStatus == 0"><span>审核中</span></div>
          <div class="rejected head" v-if="item.reviewedStatus == 2" @click="revamp(item.id)"><span>驳回</span></div>
          <div class="passjia" v-if="item.reviewedStatus == 3" @click="revamp(item.id)"><span>通过</span></div>
          <div class="line">{{item.channelName}}</div>
          <div class="line">
            <img :src="item.icon" alt>
          </div>
          <div class="delBtn" v-if="userinfo.rolesId == 1 || userinfo.rolesId == 8"><i class="el-icon-error error" @click="deletechannel(item.id)"></i></div>
          <!--  -->
          <div class="lines">
            <span v-if="item.channelType == 6 && (item.wxReviewedStatus == 4 || item.wxReviewedStatus == null || item.wxReviewedStatus) && item.wxReviewedStatus != 2" class="blueBtn fontsize12" @click="wxaddmch(merchantinfo.id,item.id)">申请微信小微进件</span>
            <span v-if="item.channelType == 4 && item.reviewedStatus == 1 && item.agreementStatus != 1" class="blueBtn fontsize12" @click="elecContractSign(item.id)">签署电子协议</span>
            <span v-if="item.channelType == 6 && item.wxReviewedStatus == 0">小微审核中...</span>
            <span class="bule" @click="Order(item.channelOrderId)" v-if="item.channelType == 4 && item.reviewedStatus == 0 && item.channelOrderId">工单号</span>
            <span class="blue" v-if="item.channelType == 6 && item.wxReviewedStatus == 2">小微申请通过</span>
            <a class="bule" :href="item.wxSignurl" target="_blank" v-if="item.channelType == 6 && item.wxReviewedStatus == 1">点击签约</a>
            <div class="btn">
              <div @click="openfenzhang(item)" v-if="item.isDiv == 1 && (item.channelType == 16 || item.channelType == 24 || item.channelType == 26)">分账配置</div>
              <div @click="splitopen(item.channelType)" v-if="(item.isDiv == 0 || item.isDiv == 2) && (item.channelType == 16 || item.channelType == 24 || item.channelType == 26)">开通分账</div>
            </div>
          </div>
          <div :title="item.wxReviewedReason" style="height:20px;width:100%;text-align: center;color:red;"><span @click="reject(item.wxReviewedReason)" v-if="item.wxReviewedStatus == 4">驳回</span></div>

        </div>

        <div class="tip">
          <!-- <span v-if="item.reviewedStatus == 1" class="bule">开通蓝海</span>
          <span v-if="item.reviewedStatus == 1" class="bule">开通绿洲</span> -->

        </div>
        <!-- <div class="tip error"> <span v-if="item.reviewedStatus != 1">*{{item.reviewedReason}}</span></div> -->
      </div>

      <!-- <div class="cBox">
                <div class="channelitem">
                    <div class="line"><img src="../../assets/img/img.jpg" alt="">网商(果盘)</div>
                    <div class="state pass">审核通过</div>
                </div>
                <div class="tip"><span class="bule">开通蓝海</span></div>
      </div>-->
      <!-- <div class="cBox">
                <div class="channelitem">
                    <div class="line"><img src="../../assets/img/img.jpg" alt="">网商(果盘)</div>
                    <div class="state fpass">支付宝通过,微信通过</div>
                </div>
                <div class="tip"><span class="bule">开通蓝海</span>&nbsp;&nbsp;<span class="bule">开通绿洲</span></div>
      </div>-->
      <!-- <div class="cBox">
                <div class="channelitem">
                    <div class="line"><img src="../../assets/img/img.jpg" alt="">网商(果盘)</div>
                    <div class="state review">审核中</div>
                </div>
                <div class="tip">&nbsp;</div>
      </div>-->
    </div>
    <!-- 项目 -->
    <div class="title" v-if="merchantinfo.status== 0 || merchantinfo.status == 98 || merchantinfo.status == 10">
      <span>项目</span>
      <div>
        <el-button icon="el-icon-refresh"></el-button>
      </div>
    </div>
    <div class="container" v-if="merchantinfo.status== 0 || merchantinfo.status == 98 || merchantinfo.status == 10">
      <div v-if="merchantinfo.qimaiStatus == 1" class="project">
        <div class="projectitem">
          <el-button icon="el-icon-star-on" type="success" size="medium">智慧零售</el-button>
        </div>
        <div class="tip">
          <span class="open">已开通</span>
        </div>
      </div>
      <div v-else class="project">
        <div class="projectitem">
          <el-button icon="el-icon-star-on" type="info" size="medium" @click="registerQiMai()">智慧零售</el-button>
        </div>
        <div class="tip">
          <span class="bule" @click="registerQiMai()">开通</span>
        </div>
      </div>
      <div class="project" v-if="merchantinfo.pid">
        <div class="projectitem">
          <el-button icon="el-icon-star-on" type="primary" size="medium">总分店</el-button>
        </div>
        <div class="tip">
          <span class="bule" @click="zonefendianbtn(merchantinfo.id)">编辑</span>&nbsp;&nbsp;
          <span class="red" @click="chainclose(merchantinfo.id)">关闭</span>
        </div>
      </div>
      <!-- <div class="project">
        <div class="projectitem">
          <el-button icon="el-icon-goods" type="info" size="medium" @click="invoice()">电子发票</el-button>
        </div>
        <div class="tip">
          <span class="bule" @click="invoice()">开通</span>
        </div>
      </div> -->
    </div>
    <!-- 标签 -->
    <div class="title" v-if="this.rolesId == 1 || this.rolesId == 2 || this.rolesId == 8 ||this.rolesId == 9">
      <span>标签</span>
      <div>
        <!-- <el-button type="primary">同步渠道</el-button> -->
        <el-button type="primary" @click="popuptag">添加标签</el-button>
      </div>
    </div>
    <div class="container container1" v-if="this.rolesId == 1 || this.rolesId == 2 || this.rolesId == 8 ||this.rolesId == 9">
      <el-tag class="el_tag" v-for="item in adm_tag" closable @close="handleClose(item.key)" :key="item.label" effect="plain">
        {{ item.label }}
      </el-tag>
      <el-tag class="el_tag" v-for="item in cw_tag" closable @close="handleClose(item.key)" type="success" :key="item.label" effect="plain">
        {{ item.label }}
      </el-tag>
      <el-tag class="el_tag" v-for="item in fws_tag" closable @close="handleClose(item.key)" type="warning" :key="item.label" effect="plain">
        {{ item.label }}
      </el-tag>
    </div>
    <br>
    <br>
    <!-- 微信支付配置 -->
    <el-dialog v-dialogDrag title="支付配置" :visible.sync="visible" width="45%" :close-on-click-modal="false">
      <el-form :model="paydeploy" status-icon ref="paydeploy" label-width="110px" class="demo-dynamic">
        <el-form-item label="渠道商户号">
          <el-input type="text" v-model="paydeploy.mchId" :disabled='mchiddis' autocomplete="off">
            <el-button slot="append" type="info" size="medium" @click="mchiddisBtn()">修改</el-button>
          </el-input>
        </el-form-item>
        <el-form-item v-if="paydeploy.channelType == 25" label="商户号">
          <el-input type="text" v-model="paydeploy.servAppid" autocomplete="off">
          </el-input>
        </el-form-item>
        <!-- <el-form-item v-if="paydeploy.channelType == 25" label="key">
          <el-input type="text" v-model="paydeploy.mchKey"  autocomplete="off">
          </el-input>
        </el-form-item> -->
        <el-form-item v-if="paydeploy.channelType == 25" label="PID">
          <el-input type="text" v-model="paydeploy.servInstno" autocomplete="off">
          </el-input>
        </el-form-item>

        <el-form-item v-if="paydeploys == 1" label="渠道微信子商户">
          <el-input type="text" v-model="paydeploy.wxMchId" autocomplete="off"></el-input>
        </el-form-item>
        <el-form-item v-if="paydeploys == 1" label="服务商模式">
          <el-select class="servicelevel" v-model="paydeploy.wxMode" placeholder>
            <el-option keys="1" label="服务商模式" :value="0"></el-option>
            <el-option keys="2" label="子商户模式" :value="1"></el-option>
          </el-select>
        </el-form-item>
        <el-form-item v-if="paydeploys == 1" label="小程序appid">
          <el-input type="text" v-model="paydeploy.miniAppid" autocomplete="off"></el-input>
        </el-form-item>
        <el-form-item v-show="paydeploy.wxMode == 1 && paydeploys == 1" label="appid">
          <el-input type="text" v-model="paydeploy.wxAppid" autocomplete="off"></el-input>
        </el-form-item>
        <el-form-item v-show="paydeploy.wxMode == 1 && paydeploys == 1" label="appsecret">
          <el-input type="text" v-model="paydeploy.wxAppsecret" autocomplete="off"></el-input>
        </el-form-item>
        <el-form-item v-show="paydeploy.channelType == 3 || paydeploy.channelType == 9 || paydeploy.channelType == 15 || paydeploy.channelType == 12 || paydeploy.channelType == 25" label="商户秘钥">
          <el-input type="text" v-model="paydeploy.mchKey" autocomplete="off"></el-input>
        </el-form-item>
        <el-form-item v-show="paydeploy.channelType == 3 || paydeploy.channelType == 9 || paydeploy.channelType == 15 || paydeploy.channelType == 12" label="app-appid">
          <el-input type="text" v-model="paydeploy.appAppid" autocomplete="off"></el-input>
        </el-form-item>
        <!-- 支付宝官方直连 !-->
        <el-form-item v-show="merchantinfo.aliChannelType == 6 && paydeploys == 2" label="支付宝appid">
          <el-input type="text" v-model="paydeploy.aliAppid" autocomplete="off"></el-input>
        </el-form-item>
        <el-form-item v-show="merchantinfo.aliChannelType == 6 && paydeploys == 2" label="口碑授权token">
          <el-input type="text" v-model="paydeploy.aliToken" autocomplete="off"></el-input>
        </el-form-item>
        <el-form-item v-show="merchantinfo.aliChannelType == 6 && paydeploys == 2" label="pid">
          <el-input type="text" v-model="paydeploy.aliPid" autocomplete="off"></el-input>
        </el-form-item>
        <el-form-item v-show="merchantinfo.aliChannelType == 6 && paydeploys == 2" label="外部门店编号">
          <el-input type="text" v-model="paydeploy.aliOuterid" autocomplete="off"></el-input>
        </el-form-item>
        <el-form-item v-show="merchantinfo.aliChannelType == 6 && paydeploys == 2" label="支付宝商户ID">
          <el-input type="text" v-model="paydeploy.aliUserId" :disabled='userinfo.rolesId == 1 || userinfo.rolesId == 8 ? false : true' autocomplete="off"></el-input>
        </el-form-item>
      </el-form>
      <span slot="footer" class="dialog-footer">
        <el-button @click="visible = false">取消</el-button>
        <!-- @click="visible = false" -->
        <el-button v-if="paydeploys == 1" type="primary" @click="updatewx()">确定</el-button>
        <el-button v-if="paydeploys == 2" type="primary" @click="updateali()">确定</el-button>
      </span>
    </el-dialog>
    <!-- 支付宝支付配置 -->
    <!-- <el-dialog v-dialogDrag title="支付配置" :visible.sync="alivisible" width="45%" :close-on-click-modal = "false">
      <el-form
        :model="paydeploy"
        status-icon
        ref="paydeploy"
        label-width="110px"
        class="demo-dynamic"
      >
        <el-form-item label="渠道商户号">
          <el-input type="text" v-model="paydeploy.mchId" autocomplete="off"></el-input>
        </el-form-item>
        <el-form-item v-show="paydeploy.channelType == 3 || paydeploy.channelType == 9 || paydeploy.channelType == 15" label="商户秘钥">
          <el-input type="text" v-model="paydeploy.mchKey" autocomplete="off"></el-input>
        </el-form-item>
      </el-form>
      <span slot="footer" class="dialog-footer">
        <el-button @click="visible = false">取消</el-button>
        <el-button type="primary" @click="updatewx()">确定</el-button>
      </span>
    </el-dialog> -->
    <!-- 微信关注配置 -->
    <el-dialog v-dialogDrag title="微信关注配置" :visible.sync="attention" width="60%" :close-on-click-modal="false">
      <el-form :model="paydeploy" status-icon ref="paydeploy" label-width="110px" class="demo-dynamic">
        <div style="width:100%; display:flex;justify-content: center;align-items: center;">
          <el-input style="width: 38%;margin-right: 2%;" type="text" placeholder="支付appid" v-model="addappid.payappid"></el-input>
          <el-input style="width: 38%;margin-right: 2%;" type="text" placeholder="关注appid" v-model="addappid.attentionid"></el-input>
          <el-button type="primary" @click="addappids">添加</el-button>
        </div>
        <el-table :data="wxlists.appidList" style="width: 100%" max-height="250" align="center">
          <el-table-column fixed prop="subappid" label="支付appid" align="center"></el-table-column>
          <el-table-column fixed prop="status" label="状态" align="center">
            <template slot-scope="scope">
              <span v-if="scope.row.status == 0">正常</span>
              <span v-else-if="scope.row.status == 1">驳回</span>
              <span v-else-if="scope.row.status == 2">处理中</span>
            </template>
          </el-table-column>
          <el-table-column fixed prop="failReason" label="说明" align="center"></el-table-column>
          <el-table-column fixed prop="subscribeappid" label="关注appid" align="center"></el-table-column>
          <el-table-column fixed="right" label="操作" width="120">
            <template slot-scope="scope">
              <el-button v-if="scope.row.delete" @click.native.prevent="deleteRow(scope.$index, wxlists.appidList,wxlists.appidList.length)" type="text" size="small">删除</el-button>
              <el-button type="text" size="small" @click="appremove(scope.row.id)" v-if="scope.row.status == 1">删除</el-button>
            </template>
          </el-table-column>
        </el-table>
        <div class="flex">
          <el-form-item label="支付授权目录" style="width:100%">
            <el-select style="width:100px;margin-right:5%;" class="servicelevel" v-model="paydeploy.urltype" placeholder>
              <el-option keys="1" label="http://" value="http://"></el-option>
              <el-option keys="2" label="https://" value="https://"></el-option>
            </el-select>
            <el-input style="width:200px;margin-right:5%;" type="text" placeholder="支付授权目录" v-model="paydeploy.url"></el-input>
            <el-button type="primary" @click="addurl">添加</el-button>
          </el-form-item>
        </div>
        <div style="padding:10px 30px;box-sizing: border-box;color:red;">
          所有使用JS API方式发起支付请求的链接地址，都必须在支付授权目录之下
          <br>最多设置5个支付授权目录, 且域名必须通过ICP备案
          <br>头部要包含http或https，以左斜杠“/”结尾
          <br>
        </div>
        <el-table :data="wxlists.jspathList" style="width: 100%" max-height="250" align="center">
          <el-table-column fixed prop="jsapipath" label="支付授权目录" align="center"></el-table-column>
          <el-table-column fixed prop="status" label="状态" align="center">
            <template slot-scope="scope">
              <span v-if="scope.row.status == 0">正常</span>
              <span v-else-if="scope.row.status == 1">驳回</span>
              <span v-else-if="scope.row.status == 2">处理中</span>
            </template>
          </el-table-column>
          <el-table-column fixed prop="failReason" label="说明" align="center"></el-table-column>
          <el-table-column fixed="right" label="操作" width="120">
            <template slot-scope="scope">
              <el-button v-if="scope.row.delete" @click.native.prevent="deleteRow(scope.$index, wxlists.jspathList,wxlists.jspathList.length)" type="text" size="small">删除</el-button>
              <el-button type="text" size="small" @click="appremove(scope.row.id)" v-if="scope.row.status == 1">删除</el-button>
            </template>
          </el-table-column>
        </el-table>
        <!-- <div class="urllist">
          <div v-for="(item, index) in wxlists.jspathList" :key="index">
            {{item.jsapipath}} &nbsp;&nbsp;
            <span
              @click="delurl(index, wxlists.jspathList,wxlists.jspathList.length)"
              style="color:blue;"
              v-if="item.delete"
            >删除</span>
          </div>
        </div> -->
      </el-form>
      <span slot="footer" class="dialog-footer">
        <el-button @click="attention = false">取消</el-button>
        <!-- @click="visible = false" -->
        <el-button type="primary" @click="appsave()">确定</el-button>
      </span>
    </el-dialog>
    <!-- 微信小程序配置 -->
    <el-dialog v-dialogDrag title="微信小程序关注配置" :visible.sync="wxminiprogram" width="60%" :close-on-click-modal="false">
      <el-form :model="paydeploy" status-icon ref="paydeploy" label-width="110px" class="demo-dynamic">
        <div style="width:100%; display:flex;justify-content: center;align-items: center;">
          <el-input style="width: 38%;margin-right: 2%;" type="text" placeholder="支付appid" v-model="addappid.payappid"></el-input>
          <el-button type="primary" @click="addappids">添加</el-button>
        </div>
        <el-table :data="wxlists.appidList" style="width: 100%" max-height="250" align="center">
          <el-table-column fixed prop="subappid" label="支付appid" align="center"></el-table-column>
          <el-table-column fixed prop="status" label="状态" align="center">
            <template slot-scope="scope">
              <span v-if="scope.row.status == 0">正常</span>
              <span v-else-if="scope.row.status == 1">驳回</span>
              <span v-else-if="scope.row.status == 2">处理中</span>
            </template>
          </el-table-column>
          <el-table-column fixed prop="failReason" label="说明" align="center"></el-table-column>
          <el-table-column fixed="right" label="操作" width="120">
            <template slot-scope="scope">
              <el-button v-if="scope.row.delete" @click.native.prevent="deleteRow(scope.$index, wxlists.appidList,wxlists.appidList.length)" type="text" size="small">删除</el-button>
              <el-button type="text" size="small" @click="appremove(scope.row.id)" v-if="scope.row.status == 1">删除</el-button>
            </template>
          </el-table-column>
        </el-table>
      </el-form>
      <span slot="footer" class="dialog-footer">
        <el-button @click="wxminiprogram = false">取消</el-button>
        <!-- @click="visible = false" -->
        <el-button type="primary" @click="appsave(2)">确定</el-button>
      </span>
    </el-dialog>
    <!-- 费率配置 -->
    <el-dialog v-dialogDrag title="费率配置" :visible.sync="rate" width="45%" :close-on-click-modal="false">
      <el-form :model="ratearr" status-icon ref="ratearr" label-width="110px" class="demo-dynamic">
        <el-form-item label="通道">
          <el-input type="text" autocomplete="off" :value="ChannelName" disabled></el-input>
        </el-form-item>
        <el-form-item label="费率">
          <el-select class="servicelevels" v-model="ratearr.ratenum" placeholder="选择费率" @change="rateevent">
            <el-option v-for="(item, index) in ratelists" :key="index" :label="item.rate/10" :value="item.rate"></el-option>
          </el-select>‰
        </el-form-item>
      </el-form>
      <span slot="footer" class="dialog-footer">
        <el-button @click="rate = false">取消</el-button>
        <el-button type="primary" @click="rateok">确定</el-button>
      </span>
    </el-dialog>
    <!-- 切换通道 -->
    <el-dialog v-dialogDrag title="切换通道" :visible.sync="changechannel" width="45%" :close-on-click-modal="false">
      <el-form status-icon ref="channelarr" class="demo-dynamic">
        <el-form-item label="通道">
          <el-select class="servicelevel" v-model="channelarr.ratenum" placeholder="选择通道" :disabled="rateswitch" @change="changechanne">
            <el-option v-for="(item, index) in channellist" :key="index" :label="item.channelName" :value="item.id"></el-option>
          </el-select>
        </el-form-item>
      </el-form>
      <span slot="footer" class="dialog-footer">
        <el-button @click="changechannel = false">取消</el-button>
        <!-- @click="visible = false" -->
        <el-button type="primary" @click="channelok">确定</el-button>
      </span>
    </el-dialog>
    <!-- 结算周期 -->
    <el-dialog v-dialogDrag title="结算配置" :visible.sync="checkout" width="45%" :close-on-click-modal="false">
      <el-form v-if="settlementtype == 1" status-icon ref="channelarr" class="demo-dynamic">
        <el-form-item label="结算">
          <el-select class="servicelevel" v-model="channelarr.wxSettlement" placeholder="选择结算">
            <el-option v-for="(item , index) in Settlement" :key="index" :label="item" :value="item"></el-option>
          </el-select>
        </el-form-item>
      </el-form>
      <el-form v-if="settlementtype == 2" status-icon ref="channelarr" class="demo-dynamic">
        <el-form-item label="结算">
          <el-select class="servicelevel" v-model="channelarr.aliSettlement" placeholder="选择结算">
            <el-option v-for="(item , index) in Settlement" :key="index" :label="item" :value="item"></el-option>
          </el-select>
        </el-form-item>
      </el-form>
      <span slot="footer" class="dialog-footer">
        <el-button @click="checkout = false">取消</el-button>
        <!-- @click="visible = false" -->
        <el-button type="primary" @click="updatesettlement">确定</el-button>
      </span>
    </el-dialog>
    <!-- 支付宝授权配置 -->
    <el-dialog v-dialogDrag title="口碑授权" :visible.sync="aliBox" width="45%" :close-on-click-modal="false">
      <div class="alibox">
        <span class="itemtit">APPID</span>
        <span>{{alipayautharr.appId}}</span>
      </div>
      <div class="alibox">
        <span class="itemtit">授权码</span>
        <div>
          <div id="qrcode"></div>
        </div>
      </div>
      <span slot="footer" class="dialog-footer">
        <el-button @click="aliBox = false">取消</el-button>
        <!-- @click="visible = false" -->
        <el-button type="primary" @click="aliBox = false">确定</el-button>
      </span>
    </el-dialog>
    <!-- 银行卡支付配置 -->
    <el-dialog v-dialogDrag title="银行卡支付配置" :visible.sync="banks" width="45%" :close-on-click-modal="false">
      <el-form :model="bank" status-icon ref="bank" label-width="110px" class="demo-dynamic">
        <el-form-item label="银联商户号">
          <el-input type="text" v-model="bank.mchId" autocomplete="off" placeholder="银联商户号"></el-input>
        </el-form-item>
      </el-form>
      <span slot="footer" class="dialog-footer">
        <el-button @click="banks = false">取消</el-button>
        <!-- @click="visible = false" -->
        <el-button type="primary" @click="addbank()">确定</el-button>
      </span>
    </el-dialog>
    <!-- 银行卡成本 -->
    <el-dialog v-dialogDrag title="修改成本" :visible.sync="cost" width="45%" :close-on-click-modal="false">
      <el-form :model="bank" status-icon ref="bank" label-width="110px" class="demo-dynamic">
        <el-form-item label="信用卡" style="width:80%;">
          <el-input style="width:80%;" type="text" v-model="costs.creditcardProfitRate" autocomplete="off" placeholder="信用卡"></el-input><span>‰</span>
        </el-form-item>
        <el-form-item label="储蓄卡" style="width:80%;">
          <el-input style="width:80%;" type="text" v-model="costs.debitcardProfitRate" autocomplete="off" placeholder="储蓄卡"></el-input><span>‰</span>
        </el-form-item>
        <el-form-item label="封顶" style="width:80%;">
          <el-input style="width:80%;" type="text" v-model="costs.debitcardTopFee" autocomplete="off" placeholder="储蓄卡"></el-input><span>元</span>
        </el-form-item>
      </el-form>
      <span slot="footer" class="dialog-footer">
        <el-button @click="cost = false">取消</el-button>
        <!-- @click="visible = false" -->
        <el-button type="primary" @click="updateBankRate()">确定</el-button>
      </span>
    </el-dialog>
    <!-- 添加通道 -->
    <el-dialog v-dialogDrag title="添加通道" :visible.sync="addchannel" width="45%" :close-on-click-modal="false">
      <el-form status-icon ref="channelarr" class="demo-dynamic">
        <el-form-item label="通道">
          <el-select class="servicelevel" v-model="channelarr.channelid" @change="watchchannel" placeholder="选择通道">
            <el-option v-for="(item, index) in channellists" :key="index" :label="item.options" :value="item.code"></el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="费率">
          <el-select class="servicelevels" v-model="channelrate" placeholder="选择费率" @change="channelrates">
            <el-option v-for="(item, index) in ratelists" :key="index" :label="item.rate/10" :value="item.rate"></el-option>
          </el-select>‰
        </el-form-item>
      </el-form>
      <span slot="footer" class="dialog-footer">
        <el-button @click="addchannel = false">取消</el-button>
        <!-- @click="visible = false" -->
        <el-button type="primary" @click="addchannelok">确定</el-button>
      </span>
    </el-dialog>
    <!-- 签约小微 -->
    <el-dialog v-dialogDrag title="签约小微" :visible.sync="signingBox" width="45%" :close-on-click-modal="false">
      <div class="alibox">
        <span class="itemtit">签约码</span>
        <div>
          <div class="signingcode"></div>
        </div>
      </div>
      <span slot="footer" class="dialog-footer">
        <el-button @click="signingBox = false">关闭</el-button>
        <!-- @click="visible = false" -->
      </span>
    </el-dialog>
    <!-- 标签配置 -->
    <el-dialog v-dialogDrag title="添加标签" :visible.sync="Channeldeploy1" width="35%" :close-on-click-modal='false'>
      <el-transfer v-model="usedTags" :data="unUsedTags" :titles="['未选标签', '已选择标签']" filterable filter-placeholder="请输入关键词">
        <!--  -->
      </el-transfer>
      <div style="width:100%;text-align:right;margin-top:30px;">
        <el-button type="primary" @click="Channeldeploy1 = false">取消</el-button>
        <el-button type="primary" @click='addLabel()'>确定</el-button>
      </div>
    </el-dialog>
    <!-- 开通电子发票 -->
    <el-dialog v-dialogDrag title="开通电子发票" :visible.sync="bill" width="45%" :close-on-click-modal="false">
      <el-form :model="invoices" status-icon ref="invoices" label-width="110px" class="demo-dynamic">
        <el-form-item label="税盘号">
          <el-input type="text" autocomplete="off" :value="invoices.num"></el-input>
        </el-form-item>
      </el-form>
      <span slot="footer" class="dialog-footer">
        <el-button @click="bill = false">取消</el-button>
        <el-button type="primary">确定</el-button>
      </span>
    </el-dialog>
    <!-- 总分店模式配置 -->
    <el-dialog v-dialogDrag title="总分店模式配置" :visible.sync="zongfendian" width="45%" :close-on-click-modal="false">
      <el-form :model="setupshops" status-icon ref="setupshops" label-width="110px" class="demo-dynamic">
        <el-form-item label="角色选择">
          <el-radio-group v-model="setupshops.type">
            <el-radio label="-1">总店</el-radio>
            <el-radio label="2">分店</el-radio>
          </el-radio-group>
        </el-form-item>
        <el-form-item label="选择总店" v-if="setupshops.type == 2">
          <!-- <el-input :disabled="(setupshops.type == 1)?true:false" type="text" v-model.trim="addmendian.phone" autocomplete="off"></el-input> -->
          <el-autocomplete v-if="userinfo.rolesId == 1 || userinfo.rolesId == 8 || userinfo.rolesId == 2 || userinfo.rolesId == 9" class="servicename" v-model.trim="setupshops.dianming" :fetch-suggestions="querySearch3" placeholder="选择总店" @select="dianming"></el-autocomplete>
        </el-form-item>
        <el-form-item label="选择营业时间" v-if="setupshops.type == 2">
          <!-- <el-time-picker
            :disabled="(setupshops.type == 1)?true:false"
            is-range
            v-model="setupshops.time"
            value-format="HH:mm"
            format="HH:mm"
            range-separator="至"
            start-placeholder="开始时间"
            end-placeholder="结束时间"
            placeholder="选择时间范围">
          </el-time-picker> -->
          <el-time-picker v-model="setupshops.openTime" value-format="HH:mm" format="HH:mm" placeholder="开始时间">
          </el-time-picker>至
          <el-time-picker v-model="setupshops.closeTime" value-format="HH:mm" format="HH:mm" placeholder="结束时间">
          </el-time-picker>
        </el-form-item>
        <el-form-item label="是否限额" v-if="setupshops.type == 2">
          <el-radio-group v-model="setupshops.permissions" :disabled="(setupshops.type == 1)?true:false">
            <el-radio label="1">是</el-radio>
            <el-radio label="2">否</el-radio>
          </el-radio-group>
        </el-form-item>
        <el-form-item label="限额额度" v-if="setupshops.type == 2">
          <el-input style="width:80%" placeholder="请输入限额额度" :disabled="(setupshops.permissions == 2)?true:false" type="text" v-model.trim="setupshops.lines" autocomplete="off"></el-input>
        </el-form-item>
      </el-form>
      <span slot="footer" class="dialog-footer">
        <el-button @click="zongfendian = false">取消</el-button>
        <!-- @click="visible = false" -->
        <el-button type="primary" @click="setupshopok()">确定</el-button>
      </span>
    </el-dialog>
    <!-- 分账配置 -->
    <el-dialog v-dialogDrag title="分账配置" :visible.sync="fenzhang" width="45%" :close-on-click-modal="false">
      <div class="demo-input-size">
        <el-autocomplete style="width:40%;margin-right:10px" class="servicename" v-model.trim="fenzhangs.name" :fetch-suggestions="querySearch" placeholder="商户号" @select="serviceid"></el-autocomplete>
        <el-input style="width:40%;margin-right:10px" placeholder="分账比例" maxlength="3" v-model="fenzhangs.splitRate" oninput="if(this.value=='00'){this.value='0';}else{this.value=this.value.replace(/[^0-9]/g,'')}">
        </el-input>
        <el-button type="primary" plain @click="addfenzhang()">添加</el-button>
      </div>
      <el-table :data="fenzhangData" style="width: 100%">
        <el-table-column align=center prop="merchantNo" label="商户号"></el-table-column>
        <el-table-column align=center prop="merchantName" label="商户名"></el-table-column>
        <el-table-column align=center prop="splitRate" label="分账比例(%)"></el-table-column>
        <el-table-column fixed="right" align="center" label="操作" width="120">
          <template slot-scope="scope">
            <el-button type="text" size="small" @click="delfenzhang(scope.row.merchantNo)">删除</el-button>
          </template>
        </el-table-column>
      </el-table>
      <span slot="footer" class="dialog-footer">
        <el-button @click="fenzhang = false">取消</el-button>
        <!-- @click="visible = false" -->
        <el-button type="primary" @click="splitconfigt()">确定</el-button>
      </span>
    </el-dialog>
    <!-- 权限配置 -->
    <el-dialog v-dialogDrag title="权限配置" :visible.sync="jurisdiction" width="45%" :close-on-click-modal="false">
      <el-form ref="form" size="mini" label-position="left" label-width="125px">
        <el-form-item label="门店管理员退款" prop="delivery">
          <el-switch active-value='1' inactive-value='0' v-model="merchantinfo.shopRefund"></el-switch>
        </el-form-item>
        <!-- 支付宝 -->
        <el-form-item class="border pay-form-inline" label="支付宝支付总开关" prop="delivery">
          <el-switch active-value='1' inactive-value='0' v-model="merchantinfo.aliSwitch"></el-switch>
        </el-form-item>
        <el-form-item class="pay-form-inline" label="B扫C">
          <el-radio-group v-model="payinfo.aliborc" :disabled='merchantinfo.aliSwitch == 1 ? false: true'>
            <el-radio label="0">启用</el-radio>
            <el-radio label="1">禁用</el-radio>
          </el-radio-group>
        </el-form-item>
        <el-form-item class="pay-form-inline" label="C扫B">
          <el-radio-group v-model="payinfo.alicorb" :disabled='merchantinfo.aliSwitch == 1 ? false: true'>
            <el-radio label="0">启用</el-radio>
            <el-radio label="1">禁用</el-radio>
          </el-radio-group>
        </el-form-item>
        <el-form-item class="pay-form-inline" label="退款">
          <el-radio-group v-model="payinfo.alirefund" :disabled='merchantinfo.aliSwitch == 1 ? false: true'>
            <el-radio label="0">启用</el-radio>
            <el-radio label="1">禁用</el-radio>
            <el-radio label="2">不可隔日退款</el-radio>
          </el-radio-group>
        </el-form-item>
        <!-- 微信 -->
        <el-form-item class="border pay-form-inline" label="微信支付总开关" prop="delivery">
          <el-switch active-value='1' inactive-value='0' v-model="merchantinfo.wxSwitch"></el-switch>
        </el-form-item>
        <el-form-item class="pay-form-inline" label="B扫C">
          <el-radio-group v-model="payinfo.wxborc" :disabled='merchantinfo.wxSwitch == 1 ? false: true'>
            <el-radio label="0">启用</el-radio>
            <el-radio label="1">禁用</el-radio>
          </el-radio-group>
        </el-form-item>
        <el-form-item class="pay-form-inline" label="C扫B">
          <el-radio-group v-model="payinfo.wxcorb" :disabled='merchantinfo.wxSwitch == 1 ? false: true'>
            <el-radio label="0">启用</el-radio>
            <el-radio label="1">禁用</el-radio>
          </el-radio-group>
        </el-form-item>
        <el-form-item class="pay-form-inline" label="退款">
          <el-radio-group v-model="payinfo.wxrefund" :disabled='merchantinfo.wxSwitch == 1 ? false: true'>
            <el-radio label="0">启用</el-radio>
            <el-radio label="1">禁用</el-radio>
            <el-radio label="2">不可隔日退款</el-radio>
          </el-radio-group>
        </el-form-item>
        <!-- 云闪付 -->
        <el-form-item class="border pay-form-inline" label="云闪付支付总开关" prop="delivery">
          <el-switch active-value='1' inactive-value='0' v-model="merchantinfo.uniSwitch"></el-switch>
        </el-form-item>
        <el-form-item class="pay-form-inline" label="B扫C">
          <el-radio-group v-model="payinfo.uniborc" :disabled='merchantinfo.uniSwitch == 1 ? false: true'>
            <el-radio label="0">启用</el-radio>
            <el-radio label="1">禁用</el-radio>
          </el-radio-group>
        </el-form-item>
        <el-form-item class="pay-form-inline" label="C扫B">
          <el-radio-group v-model="payinfo.unicorb" :disabled='merchantinfo.uniSwitch == 1 ? false: true'>
            <el-radio label="0">启用</el-radio>
            <el-radio label="1">禁用</el-radio>
          </el-radio-group>
        </el-form-item>
        <el-form-item class="pay-form-inline" label="退款">
          <el-radio-group v-model="payinfo.unirefund" :disabled='merchantinfo.uniSwitch == 1 ? false: true'>
            <el-radio label="0">启用</el-radio>
            <el-radio label="1">禁用</el-radio>
            <el-radio label="2">不可隔日退款</el-radio>
          </el-radio-group>
        </el-form-item>
        <!-- 银行卡 -->
        <el-form-item class="border pay-form-inline" label="银行卡支付总开关" prop="delivery">
          <el-switch active-value='1' inactive-value='0' v-model="merchantinfo.bankSwitch"></el-switch>
        </el-form-item>
        <el-form-item class="pay-form-inline" label="刷卡">
          <el-radio-group v-model="payinfo.bankborc" :disabled='merchantinfo.bankSwitch == 1 ? false: true'>
            <el-radio label="0">启用</el-radio>
            <el-radio label="1">禁用</el-radio>
          </el-radio-group>
        </el-form-item>
        <el-form-item class="pay-form-inline" label="退款">
          <el-radio-group v-model="payinfo.bankrefund" :disabled='merchantinfo.bankSwitch == 1 ? false: true'>
            <el-radio label="0">启用</el-radio>
            <el-radio label="1">禁用</el-radio>
            <el-radio label="2">不可隔日退款</el-radio>
          </el-radio-group>
        </el-form-item>
      </el-form>
      <span slot="footer" class="dialog-footer">
        <el-button @click="jurisdiction = false">取消</el-button>
        <!-- @click="visible = false" -->
        <el-button type="primary" @click="payjurisdiction()">确定</el-button>
      </span>
    </el-dialog>
    <!-- 代运营配置 -->
    <el-dialog v-dialogDrag title="代运营配置" :visible.sync="threebinding" width="50%" :close-on-click-modal="false">
      <!-- <el-form status-icon ref="tarminal" label-width="150px" class="demo-dynamic">
          <el-form-item label="支付宝登录账号">
            <el-input type="text" v-model.trim="alipayAccount" autocomplete="off"></el-input>
          </el-form-item>
        </el-form>
        <span slot="footer" class="dialog-footer">
          <el-button @click="threebinding = false">取消</el-button>
          <el-button type="primary" @click="operationapply()">绑定</el-button>
        </span> -->
      <el-tabs type="border-card">
        <el-tab-pane label="①代运营申请">
          <el-form status-icon ref="tarminal" label-width="150px" class="demo-dynamic">
            <el-form-item label="支付宝登录账号">
              <el-input type="text" v-model.trim="alipayAccount" autocomplete="off"></el-input>
            </el-form-item>
          </el-form>
          <div style="text-align: center;">
            <el-button type="primary" @click="operationapply()">绑定</el-button>
          </div>
        </el-tab-pane>
        <el-tab-pane label="②同步运营操作结果">
          <div class="operbtn" style="width:100%;color:#000fd8; margin:5px 0" @click="operationresult()">同步运营操作结果</div>
        </el-tab-pane>
        <el-tab-pane label="③同步支付宝门店">
          <div class="operbtn" style="width:100%;color:rgb(0 156 216)" @click="syncShop()">同步支付宝门店</div>
        </el-tab-pane>
      </el-tabs>

    </el-dialog>
    <!-- 新蓝海 -->
    <el-dialog v-dialogDrag title="新蓝海/快销直通车" :visible.sync="newlanhai" width="50%" :close-on-click-modal="false">
      <div v-if="alilanhaival == 4" class="reds">驳回原因：{{newlanhaiinfo.applyMsg}}</div>
      <el-form status-icon ref="tarminal" label-width="150px" class="demo-dynamic">
        <el-form-item label="活动场景">
          <el-radio-group v-model="newlanhaiinfo.applyType" @change='newlanhaitype' :disabled='newlanhaidisabled'>
            <el-radio :label="1">餐饮新蓝海</el-radio>
            <el-radio :label="2">快销直通车</el-radio>
          </el-radio-group>
        </el-form-item>
        <el-form-item label="行业类目">
          <el-select class="width100" v-model="newlanhaiinfo.applyMcc" placeholder="请选择行业类目" @change="mccchange" :disabled='newlanhaidisabled'>
            <el-option v-for="(item,index) in  mcclist" :key="index" :label="item.name" :value="item.id"></el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="地址">
          <div id="app">
            <el-cascader class="width100" size="large" :options="options" v-model="newlanhaiinfo.selectedOptions" @change="handleChange">
            </el-cascader>
          </div>
        </el-form-item>
        <el-form-item label="详细地址">
          <el-input type="text" v-model.trim="newlanhaiinfo.address" autocomplete="off"></el-input>
        </el-form-item>
        <el-form-item label="资质证明材料类型">
          <el-select class="width100" v-model="newlanhaiinfo.licImageType" placeholder="请选择资质证明材料类型">
            <el-option v-for="(item,index) in  materialslist" :key="index" :label="item.name" :value="item.id"></el-option>
          </el-select>
        </el-form-item>
        <el-form-item>
          <el-upload list-type="picture-card" :action="upload" :headers="token" :show-file-list="false" :on-progress="logadings" :on-success="statusphoto">
            <img style="width:100%;height:100%" v-if="newlanhaiinfo.licImageUrl" :src="newlanhaiinfo.licImageUrl" class="avatar">
            <i v-else class="el-icon-plus avatar-uploader-icon"></i>
          </el-upload>
          <div>资质证明材料</div>
        </el-form-item>
        <el-form-item class="photo">
          <el-upload list-type="picture-card" :action="upload" :headers="token" :show-file-list="false" :on-progress="logadings" :on-success="pOutside">
            <img style="width:100%;height:100%" v-if="newlanhaiinfo.outsideUrl" :src="newlanhaiinfo.outsideUrl" class="avatar">
            <i v-else class="el-icon-plus avatar-uploader-icon"></i>
          </el-upload>
          <div>外部门头照</div>
        </el-form-item>
        <el-form-item class="photo">
          <el-upload list-type="picture-card" :action="upload" :headers="token" :show-file-list="false" :on-progress="logadings" :on-success="pInside">
            <img style="width:100%;height:100%" v-if="newlanhaiinfo.insideUrl" :src="newlanhaiinfo.insideUrl" class="avatar">
            <i v-else class="el-icon-plus avatar-uploader-icon"></i>
          </el-upload>
          <div>内部环境照</div>
        </el-form-item>
      </el-form>
      <span slot="footer" class="dialog-footer">
        <el-button @click="newlanhai = false">取消</el-button>
        <el-button type="primary" @click="newlanhaiok()">确定</el-button>
      </span>
    </el-dialog>
  </section>
</template>

<script>
import $ from "jquery";
var QRCode = require('qrcode')
import axios from "axios";
import {
  merchantdetails,
  channel,
  channelget,
  updatewx,
  ratelist,
  updaterate,
  aliupdaterate,
  uniupdaterate,
  getSettlement,
  channelselect,
  channelselects,
  updatechannel,
  applist,
  updatesettlement,
  alipayauth,
  addbank,
  updateBankRate,
  deletechannel,
  addchannels,
  registerQiMai,
  wechatRegistry,
  elecContractSign,
  updateali,
  getdimensionTagList,
  getSelectTagsByRole,
  postDimensionTagSave,
  setGreenStatus,
  setBlueStatus,
  appsave,
  postDimensionTagRemove,
  allmerchantlist,
  chaindetail,
  chainupdate,
  chainclose,
  chainsubs,
  splitinfo,
  splitconfigt,
  splitopen,
  paycfg,
  operationresult,
  operationapply,
  syncShop,
  blueSeaquery,
  blueSeaapply,
  blueSeamodify,
  appremove
} from "@/api/api";

import { provinceAndCityData, regionData, provinceAndCityDataPlus, regionDataPlus, CodeToText, TextToCode } from 'element-china-area-data';
export default {
  // name: "baseform",
  data () {
    return {
      options: regionData,
      token: { token: sessionStorage.getItem("token") },
      upload: this.$store.state.urlexcel + "/product/v31/api/merchant/uploadfile/upload",
      merchantinfo: {},
      merchantno: "",
      channelinfo: "",
      visible: false,
      alivisible: false,
      attention: false,
      rate: false,
      changechannel: false,
      checkout: false,
      aliBox: false,
      banks: false,
      cost: false,
      bill: false,
      addchannel: false,
      signingBox: false,
      rateswitch: true,
      mchiddis: true,
      wecharlvzhou: false,
      alilanhai: false,
      alilanhaival: '',
      applyMsg: '',
      zongfendian: false,
      fenzhang: false,
      jurisdiction: false,
      ratetype: "",
      channellist: "",
      channellists: "",
      userinfo: "",
      invoices: {
        num: ""
      },
      wxlists: {
        appidList: []
      },
      appidLists: [],
      jspathLists: [],
      appurl: [],
      appid: [],
      Settlement: [],
      channeltypes: "",
      paydeploys: "",
      settlementtype: "",
      alipayautharr: "",
      ratenum: "",
      channelrate: "",
      merarr: [],
      wxchannelboxinfo: {
      },
      alichannelboxinfo: {
      },
      costs: {
        creditcardProfitRate: '',
        debitcardProfitRate: '',
        debitcardTopFee: ''
      },
      bank: {
        mchId: ""
      },
      ratearr: {
        ratenum: "",
        wxratenum: "",
        uniratenum: ""
      },
      ratelists: "",
      ChannelName: "",
      channelarr: {
        ratenum: "",
        wxSettlement: "",
        aliSettlement: "",
        channelid: "",
        channelName: ""
      },
      paydeploy: {
        mchId: "",
        wxMchId: "",
        wxMode: "",
        miniAppid: "",
        wxAppid: "",
        wxAppsecret: "",
        urltype: "http://",
        url: ''
      },
      addappid: {
        payappid: "",
        attentionid: ""
      },
      addurls: {
        jsapipath: ""
      },
      setupshops: {
        type: '-1',
        openTime: '',
        closeTime: '',
        permissions: '',
        lines: '',
        pid: '-1',
        dianming: ''
      },
      merchantName: '',
      adm_tag: [],//超管 运营标签
      cw_tag: [],//财务标签
      fws_tag: [],//服务商标签
      tag_color: '',//标签颜色
      Channeldeploy1: false, //添加标签穿梭框开关
      unUsedTags: [],//添加标签穿梭框 未选择的标签
      usedTags: [],//添加标签穿梭框 已选择的标签
      rolesId: '',
      oeminfo: '',
      oemFlag: '',
      fenzhangData: [],
      fendianarr: [],
      fenzhangs: {},
      servicearr: [],
      mchId: '',
      payinfo: {},
      threebinding: false,
      operationapplybtn: true,
      operationresultbtn: true,
      syncShopbtn: true,
      alipayAccount: '',
      batchNo: '',
      newlanhai: false,
      newlanhaiinfo: {
        applyType: '',
        applyMcc: '',
        licImageType: '',
        address: '',
        outsideUrl: '',
        insideUrl: '',
        licImageUrl: '',
        selectedOptions: [],

      },
      mcclist: [],
      materialslist: [],
      newlanhaidisabled: false,
      wxminiprogram: false,
    };
  },
  created () {
    this.userinfo = JSON.parse(sessionStorage.getItem("userInfo"));
    this.merchantno = sessionStorage.getItem("merchants_id")
    // this.merchantName = JSON.parse(sessionStorage.getItem("merchants_merchantName"))
    this.merchantdetails();
    // this.channel()
    // this.channleitem()
    var aaa = sessionStorage.getItem('userInfo')
    var bbb = JSON.parse(aaa)
    this.rolesId = bbb.rolesId
    if (this.rolesId == 1 || this.rolesId == 2 || this.rolesId == 8 || this.rolesId == 9) {
      this.getdimensionTagList()//获取指定对象已拥有的标签
    }
    // 判断是否是oem
    this.oeminfo = JSON.parse(sessionStorage.getItem('oeminfo'))
    this.oemFlag = sessionStorage.getItem('oemFlag')
  },
  mounted () {

  },
  methods: {
    //   微信关注配置添加
    addappids () {
      var payarr = [];
      for (var i = 0; i < this.appidLists.length; i++) {
        payarr.push(this.appidLists[i].subappid);
      }
      // console.log(this.appidLists)
      // console.log(payarr.indexOf(this.addappid.payappid));
      // if(this.addappid.payappid == '' || this.addappid.attentionid == ''){   //2个都必填
      if (this.addappid.payappid == '') {
        this.$message.error("请输入appid");
      } else {
        if (payarr.indexOf(this.addappid.payappid) == -1) {
          // 判断填写的是否重复
          this.wxlists.appidList.push({
            subappid: this.addappid.payappid,
            subscribeappid: this.addappid.attentionid,
            delete: 1
          });
          this.appidLists.push({
            subappid: this.addappid.payappid,
            subscribeappid: this.addappid.attentionid,
            delete: 1
          });
          this.addappid.attentionid = ''
          this.addappid.payappid = ''
        } else {
          this.$message.error("appid重复");
        }
      }

    },
    //   微信关注配置添加支付授权
    addurl () {
      var urlarr = [];
      for (var i = 0; i < this.jspathLists.length; i++) {
        urlarr.push(this.jspathLists[i].jsapipath);
      }
      // console.log(urlarr,this.paydeploy.url)
      if (this.paydeploy.url == '') {
        this.$message.error("请输入支付授权目录");
      } else {
        if (urlarr.indexOf(this.paydeploy.urltype + this.paydeploy.url) == -1) {
          this.wxlists.jspathList.push({
            jsapipath: this.paydeploy.urltype + this.paydeploy.url,
            delete: 1
          });
          this.jspathLists.push({
            jsapipath: this.paydeploy.urltype + this.paydeploy.url,
            delete: 1
          });
          this.paydeploy.url = ''
        } else {
          this.$message.error("支付授权目录重复");
        }
      }

    },
    // 微信关注配置删除支付授权
    delurl (index, rows, num) {
      rows.splice(index, 1);
      this.jspathLists.splice(index - num, 1);

    },
    //   微信关注配置删除
    deleteRow (index, rows, num) {
      rows.splice(index, 1);
      this.appidLists.splice(index - num, 1);
    },
    // 详情
    merchantdetails (channle) {
      merchantdetails({}, this.merchantno).then(res => {
        // console.log(res.data);
        if (res.code == 405) {
          sessionStorage.removeItem("token");
          this.$router.push("/login");
        } else if (res.code == 200) {
          this.merchantName = res.data.merchantName
          this.merchantinfo = res.data;
          this.channelarr.wxChannelId = res.data.wxChannelId;
          this.channelarr.aliChannelId = res.data.aliChannelId;
          this.channelarr.wxSettlement = res.data.wxSettlement;
          this.channelarr.aliSettlement = res.data.aliSettlement;
          this.bank.mchId = res.data.merchantNoUni
          this.costs.creditcardProfitRate = (res.data.creditcardProfitRate / 10).toFixed(3)
          this.costs.debitcardProfitRate = (res.data.debitcardProfitRate / 10).toFixed(3)
          this.costs.debitcardTopFee = (res.data.debitcardTopFee / 100).toFixed(3)
          // 支付配置
          this.merchantinfo.bankSwitch = '1'
          this.payinfo = {
            aliborc: res.data.aliTradeSwitch.substring(0, 1),
            alicorb: res.data.aliTradeSwitch.substring(2, 3),
            alirefund: res.data.aliTradeSwitch.substring(4, 5),
            wxborc: res.data.wxTradeSwitch.substring(0, 1),
            wxcorb: res.data.wxTradeSwitch.substring(2, 3),
            wxrefund: res.data.wxTradeSwitch.substring(4, 5),
            uniborc: res.data.uniTradeSwitch.substring(0, 1),
            unicorb: res.data.uniTradeSwitch.substring(2, 3),
            unirefund: res.data.uniTradeSwitch.substring(4, 5),
            bankborc: res.data.bankTradeSwitch.substring(0, 1),
            bankrefund: res.data.bankTradeSwitch.substring(4, 5),
          }
          // 查询新蓝海状态
          this.batchNo = res.data.aliBatchNo;
          this.alilanhaival = res.data.blueseaStatus;
          if (res.data.blueseaStatus == 1) {
            blueSeaquery({
              channelId: res.data.aliChannelId
            }).then(res => {
              if (res.data.applyStatus == 2) {
                this.alilanhaival = 2
              } else if (res.data.applyStatus == 4) {
                this.alilanhaival = 4
                this.applyMsg = res.data.applyMsg
                console.log(res.data.applyMsg)
              }

            })
          }
          // if(res.data.blueseaStatus == 2){
          //    this.alilanhai = true;
          // }else{
          //   this.alilanhai = false;
          // }
          if (res.data.greenStatus == 2) {
            this.wecharlvzhou = true;
          } else {
            this.wecharlvzhou = false;
          }
          if (channle == 'wx') {
            this.ratearr.ratenum = this.splice(res.data.wxChannelRate);
          } else if (channle == "ali") {
            this.ratearr.ratenum = this.splice(res.data.aliChannelRate);
          } else if (channle == 'uni') {
            this.ratearr.ratenum = this.splice(res.data.uniChannelRate);
          }
          this.channel()
        } else if (res.code == 500) {
          this.$message.error(res.message);
        }
      });

    },
    // 通道列表
    channel () {
      let _this = this
      channel({
        merchantid: this.merchantno
      }).then(res => {
        // console.log(res);
        if (res.code == 405) {
          sessionStorage.removeItem("token");
          this.$router.push("/login");
        } else {
          this.channelinfo = res.data.rows;
          this.channleitem()
        }
      });
    },
    splice (val) {
      if (!!val) {
        var result = val.split(",", 1);
        return result[0] / 10;
      }
    },
    // 获取支付配置
    channelget (channelid) {
      channelget({}, channelid).then(res => {
        // console.log(res);
        if (res.code == 405) {
          sessionStorage.removeItem("token");
          this.$router.push("/login");
        } else {
          this.paydeploy = res.data;
        }
      });
    },
    //微信支付配置
    wecharpayset (val) {
      if (val == 1) {
        this.paydeploys = 1;
        this.channelget(this.merchantinfo.wxChannelId);
      } else if (val == 2) {
        this.paydeploys = 2;
        this.channelget(this.merchantinfo.aliChannelId);
      }
      this.visible = true;
      this.mchiddis = true;

    },
    // 修改支付配置
    updatewx () {
      updatewx(
        {
          mchId: this.paydeploy.mchId,
          wxMchId: this.paydeploy.wxMchId,
          wxMode: this.paydeploy.wxMode,
          miniAppid: this.paydeploy.miniAppid,
          wxAppid: this.paydeploy.wxAppid,
          wxAppsecret: this.paydeploy.wxAppsecret,
          aliToken: this.paydeploy.aliToken,
          aliAppid: this.paydeploy.aliAppid,
          aliPid: this.paydeploy.aliPid,
          aliOuterid: this.paydeploy.aliOuterid,
          mchKey: this.paydeploy.mchKey,
          appAppid: this.paydeploy.appAppid,
          servAppid: this.paydeploy.servAppid,
          servInstno: this.paydeploy.servInstno
        },
        this.merchantinfo.wxChannelId
      ).then(res => {
        // console.log(res);
        if (res.code == 405) {
          sessionStorage.removeItem("token");
          this.$router.push("/login");
        } else if (res.code == 200) {
          this.$message({
            message: "修改成功",
            type: "success"
          });
          this.visible = false;
        } else {
          this.$message.error(res.message);
        }
      });
    },
    // 修改支付宝支付配置
    updateali () {
      updatewx(
        {
          mchId: this.paydeploy.mchId,
          aliToken: this.paydeploy.aliToken,
          aliAppid: this.paydeploy.aliAppid,
          aliPid: this.paydeploy.aliPid,
          aliOuterid: this.paydeploy.aliOuterid,
          mchKey: this.paydeploy.mchKey,
          servAppid: this.paydeploy.servAppid,
          servInstno: this.paydeploy.servInstno,
          aliUserId: this.paydeploy.aliUserId
        },
        this.merchantinfo.aliChannelId
      ).then(res => {
        // console.log(res);
        if (res.code == 405) {
          sessionStorage.removeItem("token");
          this.$router.push("/login");
        } else if (res.code == 200) {
          this.$message({
            message: "修改成功",
            type: "success"
          });
          this.visible = false;
        } else {
          this.$message.error(res.message);
        }
      });
    },

    // 费率列表
    ratelist (channle) {
      let userinfo = JSON.parse(sessionStorage.getItem("userInfo"));
      ratelist(
        {
          roleId: userinfo.rolesId,
          fid: userinfo.fid,
          // channelType: channle,
          bdId: this.merchantinfo.bdId
        },
        this.merchantinfo.wxChannelId
      ).then(res => {
        // console.log(res);
        if (res.code == 405) {
          sessionStorage.removeItem("token");
          this.$router.push("/login");
        } else {
          this.ratelists = res.data;
        }
      });
    },
    // 打开费率box
    rateBtn (type) {
      let channle;
      if (type == "wx") {
        this.ratetype = 1;
        channle = this.merchantinfo.wxChannelType
        this.ChannelName = this.merchantinfo.wxChannelName
      } else if (type == "ali") {
        this.ratetype = 2;
        channle = this.merchantinfo.aliChannelType
        this.ChannelName = this.merchantinfo.aliChannelName
      } else if (type == 'uni') {
        this.ratetype = 3;
        channle = this.merchantinfo.uniChannelType
        this.ChannelName = this.merchantinfo.uniChannelName
      }
      this.rate = true;
      this.ratelist(channle);
      this.merchantdetails(type);
    },
    //changer费率
    rateevent (val) {
      let obj = {};
      obj = this.ratelists.find(item => {
        //这里的userList就是上面遍历的数据源
        return item.rate === val; //筛选出匹配数据
      });
      // console.log(obj);
      this.ratearr.wxratenum = obj.rateCode;
    },
    //添加changer费率
    channelrates (val) {
      let obj = {};
      obj = this.ratelists.find(item => {
        //这里的userList就是上面遍历的数据源
        return item.rate === val; //筛选出匹配数据
      });
      // console.log(obj.rate);
      this.channelrate = obj.rate;
    },
    // 修改费率
    rateok (type) {
      // console.log(this.ratearr.wxratenum);
      if (this.ratearr.wxratenum) {
        if (this.ratetype == 1) {
          updaterate(
            {
              rateCode: this.ratearr.wxratenum
            },
            this.merchantinfo.id
          ).then(res => {
            // console.log(res);
            if (res.code == 405) {
              sessionStorage.removeItem("token");
              this.$router.push("/login");
            } else if (res.code == 200) {
              this.$message({
                message: "修改成功",
                type: "success"
              });
              this.merchantdetails();
              this.rate = false;
            } else {
              this.$message.error(res.message);
            }
          });
        } else if (this.ratetype == 2) {
          aliupdaterate(
            {
              rateCode: this.ratearr.wxratenum
            },
            this.merchantinfo.id
          ).then(res => {
            // console.log(res);
            if (res.code == 405) {
              sessionStorage.removeItem("token");
              this.$router.push("/login");
            } else if (res.code == 200) {
              this.$message({
                message: "修改成功",
                type: "success"
              });
              this.merchantdetails();
              this.rate = false;
            } else {
              this.$message.error(res.message);
            }
          });
        } else if (this.ratetype == 3) {
          uniupdaterate(
            {
              rateCode: this.ratearr.wxratenum
            },
            this.merchantinfo.id
          ).then(res => {
            // console.log(res);
            if (res.code == 405) {
              sessionStorage.removeItem("token");
              this.$router.push("/login");
            } else if (res.code == 200) {
              this.$message({
                message: "修改成功",
                type: "success"
              });
              this.merchantdetails();
              this.rate = false;
            } else {
              this.$message.error(res.message);
            }
          });
        }
      } else {
        this.$message.error("请修改费率");
      }
    },
    // 选择通道
    changechanne (val) {
      this.ratenum = val
    },
    // 切换通道列表
    changechannelBox (val) {

      this.changechannel = true;
      this.merchantdetails();
      channelselect({
        merchantid: this.merchantinfo.id
      }).then(res => {
        // console.log(res);
        if (res.code == 405) {
          sessionStorage.removeItem("token");
          this.$router.push("/login");
        } else {
          this.channellist = res.data;
          if (val == 1) {
            this.channeltypes = 1;
            this.channelarr.ratenum = this.merchantinfo.wxChannelName
            this.ratenum = this.merchantinfo.wxChannelId
            this.rateswitch = false;
          } else if (val == 2) {
            this.channeltypes = 2;
            this.channelarr.ratenum = this.merchantinfo.aliChannelName
            this.ratenum = this.merchantinfo.aliChannelId
            this.rateswitch = false;
          } else if (val == 3) {
            this.channeltypes = 3;
            this.channelarr.ratenum = this.merchantinfo.uniChannelName
            this.ratenum = this.merchantinfo.uniChannelId
            this.rateswitch = false;
          }
        }
      });
    },
    // 确定切换通道
    channelok () {
      this.$confirm("确定切换通道吗？", "系统提示", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning"
      })
        .then(() => {
          if (this.channeltypes == 1) {
            updatechannel(
              {
                wxChannelId: this.ratenum
              },
              this.merchantno
            ).then(res => {
              // console.log(res);
              if (res.code == 405) {
                sessionStorage.removeItem("token");
                this.$router.push("/login");
              } else if (res.code == 200) {
                this.$message({
                  message: "切换通道成功",
                  type: "success"
                });
                this.merchantdetails();
                this.changechannel = false;
              } else {
                this.$message.error(res.message);
              }
            });
          } else if (this.channeltypes == 2) {
            updatechannel(
              {
                aliChannelId: this.ratenum
              },
              this.merchantno
            ).then(res => {
              // console.log(res);
              if (res.code == 405) {
                sessionStorage.removeItem("token");
                this.$router.push("/login");
              } else if (res.code == 200) {
                this.$message({
                  message: "切换通道成功",
                  type: "success"
                });
                this.merchantdetails();
                this.changechannel = false;
              } else {
                this.$message.error(res.message);
              }
            });
          } else if (this.channeltypes == 3) {
            updatechannel(
              {
                uniChannelId: this.ratenum
              },
              this.merchantno
            ).then(res => {
              // console.log(res);
              if (res.code == 405) {
                sessionStorage.removeItem("token");
                this.$router.push("/login");
              } else if (res.code == 200) {
                this.$message({
                  message: "切换通道成功",
                  type: "success"
                });
                this.merchantdetails();
                this.changechannel = false;
              } else {
                this.$message.error(res.message);
              }
            });
          }
        })
        .catch(() => {
          this.$message({
            type: "info",
            message: "已取消"
          });
        });
    },
    // 打开通道结算周期
    SettlementBtn (val) {
      if (val == 1) {
        this.settlementtype = 1;
        //获取通道结算周期列表
        getSettlement({}, this.merchantinfo.wxChannelId).then(res => {
          // console.log(res);
          if (res.code == 405) {
            sessionStorage.removeItem("token");
            this.$router.push("/login");
          } else if (res.code == 200) {
            let Settlement = res.data.split(",");
            this.Settlement = Settlement;
          }
        });
      } else if (val == 2) {
        this.settlementtype = 2;
        //获取通道结算周期列表
        getSettlement({}, this.merchantinfo.aliChannelId).then(res => {
          // console.log(res);
          if (res.code == 405) {
            sessionStorage.removeItem("token");
            this.$router.push("/login");
          } else if (res.code == 200) {
            let Settlement = res.data.split(",");
            this.Settlement = Settlement;
          }
        });
      }
      this.checkout = true;
      // this.getSettlement();
    },
    // 微信关注配置Box
    applistBtn () {
      this.attention = true;
      this.applist();
      this.paydeploy.url = ''
      this.addappid.attentionid = ''
      this.addappid.payappid = ''
      this.appidLists = []
      this.jspathLists = []
    },
    // 微信小程序配置
    wxminiprogrambtn () {
      this.wxminiprogram = true;
      this.applist(2);
      this.paydeploy.url = ''
      this.addappid.attentionid = ''
      this.addappid.payappid = ''
      this.appidLists = []
      this.jspathLists = []
    },
    // 获取微信关注配置
    applist (type) {
      let that = this;
      let appids = [];
      let appurls = [];
      applist({
        merchantid: this.merchantinfo.id,
        configType: type
      }).then(res => {
        // console.log(res);
        if (res.code == 405) {
          sessionStorage.removeItem("token");
          this.$router.push("/login");
        } else {
          this.wxlists = res.data;
        }
      });
    },
    // 结算周期修改按钮
    updatesettlement () {
      if (this.settlementtype == 1) {
        updatesettlement(
          {
            wxSettlement: this.channelarr.wxSettlement,
          },
          this.merchantinfo.wxChannelId
        ).then(res => {
          // console.log(res);
          if (res.code == 405) {
            sessionStorage.removeItem("token");
            this.$router.push("/login");
          } else if (res.code == 200) {
            this.$message({
              message: "修改成功",
              type: "success"
            });
            this.checkout = false;
            this.merchantdetails();
          } else {
            this.$message.error(res.message);
          }
        });
      } else if (this.settlementtype == 2) {
        updatesettlement(
          {
            aliSettlement: this.channelarr.aliSettlement
          },
          this.merchantinfo.aliChannelId
        ).then(res => {
          // console.log(res);
          if (res.code == 405) {
            sessionStorage.removeItem("token");
            this.$router.push("/login");
          } else if (res.code == 200) {
            this.$message({
              message: "修改成功",
              type: "success"
            });
            this.checkout = false;
            this.merchantdetails();
          } else {
            this.$message.error(res.message);
          }
        });
      }

    },
    // 修改微信关注配置
    appsave (num) {
      const loading = this.$loading({
        lock: true,
        text: 'Loading',
        spinner: 'el-icon-loading',
        background: 'rgba(0, 0, 0, 0.7)'
      });
      var that = this;
      axios.post(
        this.$store.state.url + "/product/v31/api/merchant/app/save",
        {
          MerchantAppidApp: this.appidLists,
          MerchantAppidPath: this.jspathLists,
          merchantid: this.merchantno,
          wxChannelId: this.channelarr.wxChannelId,
          merchantno: this.channelinfo[0].mchId,
          configType: num
        },
        {
          headers: {
            "Content-Type": "application/json",
            token: sessionStorage.getItem("token")
          }
        }
      )
        .then(function (res) {
          // console.log(res);
          loading.close();
          if (res.data.code == 405) {
            sessionStorage.removeItem("token");
            that.$router.push("/login");
          } else if (res.data.code == 200) {
            that.$message({
              message: "修改成功",
              type: "success"
            });
            if (num == 2) {
              that.wxminiprogram = false;
              that.applist(2);
            } else {
              that.attention = false;
              that.applist();
            }
            this.paydeploy.url = ''
            this.addappid.attentionid = ''
            this.addappid.payappid = ''
            loading.close();
          } else {
            that.$message.error(res.data.message);
            console.log(num)
            if (num == 2) {
              that.applist(2);
              that.wxminiprogram = false;
            } else {
              that.applist();
              that.attention = false;
            }
            loading.close();
          }
        })
        .catch(function (error) {
          // that.$message.error(res.data.message);
          loading.close();
          that.attention = false;
        });
    },
    // 删除微信关注配置
    appremove (id) {
      appremove({}, id).then(res => {
        console.log(res)
        if (res.code == 405) {
          sessionStorage.removeItem("token");
          this.$router.push("/login");
        } else {
          if (res.code == 200) {
            this.$message({
              message: "删除成功",
              type: "success"
            });
            this.applist();
          } else {
            this.$message.error(res.message);
          }
        }
      })
    },
    // 打开支付宝授权配置
    aliBoxs () {
      $('#qrcode').html('')
      this.aliBox = true;
      alipayauth({
      }, this.merchantinfo.id).then(res => {
        // console.log(res);
        if (res.code == 405) {
          sessionStorage.removeItem("token");
          this.$router.push("/login");
        } else {
          this.alipayautharr = res.data;

          QRCode.toDataURL(res.data.url)
            .then(url => {
              var qrbox = document.querySelector("#qrcode");
              const img = new Image();
              img.src = url;
              qrbox.appendChild(img);
            })
            .catch(err => {
              console.error(err)
            })

        }
      });
      // setTimeout(function(){ 

      //  }, 100);
    },
    // 配置银联商户号
    addbank () {
      addbank(
        {
          merchantNoUni: this.bank.mchId
        },
        this.merchantinfo.id
      ).then(res => {
        // console.log(res);
        if (res.code == 405) {
          sessionStorage.removeItem("token");
          this.$router.push("/login");
        } else if (res.code == 200) {
          this.$message({
            message: "修改成功",
            type: "success"
          });
          this.banks = false;
          this.bank.mchId = '';
          this.merchantdetails();
        } else {
          this.$message.error(res.message);
        }
      });
    },
    // 修改银行卡费率
    updateBankRate () {
      updateBankRate(
        {
          creditcardProfitRate: (this.costs.creditcardProfitRate * 10).toFixed(2),
          debitcardProfitRate: (this.costs.debitcardProfitRate * 10).toFixed(2),
          debitcardTopFee: (this.costs.debitcardTopFee * 100)
        },
        this.merchantinfo.id
      ).then(res => {
        // console.log(res);
        if (res.code == 405) {
          sessionStorage.removeItem("token");
          this.$router.push("/login");
        } else if (res.code == 200) {
          this.$message({
            message: "修改成功",
            type: "success"
          });
          this.cost = false;
          this.merchantdetails();
        } else {
          this.$message.error(res.message);
        }
      });
    },
    // 停用通道
    deletechannel (id) {
      this.$confirm('是否确定停用？', '提示', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning'
      }).then(() => {
        deletechannel({}, id).then(res => {
          // console.log(res);
          if (res.code == 405) {
            sessionStorage.removeItem("token");
            this.$router.push("/login");
          } else if (res.code == 200) {
            this.$message({
              message: "已停用",
              type: "success"
            });
            this.channel();
          } else {
            this.$message.error(res.message);
          }
        });
      }).catch(() => {
        this.$message({
          type: 'info',
          message: '已取消'
        });
      });


    },
    // 获取可选通道
    channelselects () {
      channelselects({}, this.merchantinfo.id).then(res => {
        // console.log(res);
        if (res.code == 405) {
          sessionStorage.removeItem("token");
          this.$router.push("/login");
        } else {
          this.channellists = res.data;
        }
      });
    },
    // 添加通道Box
    addchannelBtn () {
      this.channelselects()
      this.ratelist();
      this.channelarr = {}
      this.addchannel = true;
    },
    // 确定添加通道
    addchannelok () {
      // console.log(this.merchantinfo.agent1Id,this.channelarr.channelid,this.channelarr.channelName)]
      const loading = this.$loading({
        lock: true,
        text: 'Loading',
        spinner: 'el-icon-loading',
        background: 'rgba(0, 0, 0, 0.7)'
      });
      let switchs = false
      if (switchs) {
        return
      }
      addchannels({
        merchantid: this.merchantinfo.id,
        channelType: this.channelarr.channelid,
        channelName: this.channelarr.channelName,
        rate: this.channelrate
      }).then(res => {
        // console.log(res);
        if (res.code == 405) {
          sessionStorage.removeItem("token");
          this.$router.push("/login");
        } else if (res.code == 200) {
          this.$message({
            message: "已添加",
            type: "success"
          });
          switchs = false
          this.addchannel = false;
          this.channelrate = ''
          loading.close();
          this.channel();
        } else {
          this.$message.error(res.message);
          loading.close();
        }
      });
    },
    // chang通道
    watchchannel (val) {
      let obj = {};
      obj = this.channellists.find(item => {
        //这里的userList就是上面遍历的数据源
        return item.code === val; //筛选出匹配数据
      });
      // console.log(obj);
      this.channelarr.channelName = obj.options
    },
    // 开通智慧零售
    registerQiMai () {
      const loading = this.$loading({
        lock: true,
        text: 'Loading',
        spinner: 'el-icon-loading',
        background: 'rgba(0, 0, 0, 0.7)'
      });
      registerQiMai({}, this.merchantinfo.id).then(res => {
        // console.log(res);
        if (res.code == 405) {
          sessionStorage.removeItem("token");
          this.$router.push("/login");
        } else if (res.code == 200) {
          loading.close();
          this.$message({
            message: "已开通",
            type: "success"
          });
          this.merchantdetails();
        } else {
          loading.close();
          this.$message.error(res.message);
        }
      });
    },
    // 修改
    altermerchants () {
      this.$router.push({ path: "/altermerchants" });
      sessionStorage.setItem('auditinfo', JSON.stringify(this.merchantinfo))
      sessionStorage.removeItem("channel");
    },
    //  跳转到修改
    revamp (val) {
      this.$router.push({ path: "/altermerchants" });
      sessionStorage.setItem('auditinfo', JSON.stringify(this.merchantinfo))
      sessionStorage.setItem('channel', JSON.stringify(val))
    },
    // 申请微信小微进件
    wxaddmch (id, channelId) {
      const loading = this.$loading({
        lock: true,
        text: 'Loading',
        spinner: 'el-icon-loading',
        background: 'rgba(0, 0, 0, 0.7)'
      });
      wechatRegistry({
        channelId: channelId
      }, id).then(res => {
        // console.log(res);
        if (res.code == 405) {
          sessionStorage.removeItem("token");
          this.$router.push("/login");
        } else if (res.code == 200) {
          this.$message({
            message: "申请成功",
            type: "success"
          });
          loading.close();
          this.channel();
        } else {
          this.$message.error(res.message);
          loading.close();
        }
      });
    },
    //随行付电子协议
    elecContractSign (id) {
      this.$confirm('确定签署电子协议？', '提示', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning'
      }).then(() => {
        const loading = this.$loading({
          lock: true,
          text: 'Loading',
          spinner: 'el-icon-loading',
          background: 'rgba(0, 0, 0, 0.7)'
        });
        elecContractSign({}, id).then(res => {
          // console.log(res);
          if (res.code == 405) {
            sessionStorage.removeItem("token");
            this.$router.push("/login");
          } else if (res.code == 200) {
            this.$message({
              message: "签署成功",
              type: "success"
            });
            loading.close();
            this.channel();
          } else {
            this.$message.error(res.message);
            loading.close();
          }
        });
      }).catch(() => {
        this.$message({
          type: 'info',
          message: '已取消'
        });
      });
    },
    // 驳回原因
    reject (val) {
      this.$alert(val, '驳回原因', {
        confirmButtonText: '确定',
      });
    },
    // 工单号
    Order (id) {
      this.$alert(id, '工单号', {
        confirmButtonText: '确定',
      });
    },
    // 签约小微
    // signing(src){
    //   this.signingBox = true;
    //   $('.signingcode').html('')

    //   setTimeout(function(){
    //       QRCode.toDataURL(src)
    //         .then(url => {
    //         let qrboxs = document.querySelector(".signingcode");
    //          console.log(qrboxs)
    //         const img = new Image();
    //         img.src=url;
    //         qrboxs.appendChild(img);
    //         })
    //         .catch(err => {
    //           console.error(err)
    //         })
    //   },100)
    // }

    // 可以修改渠道号按钮
    mchiddisBtn () {

      this.$confirm('是否确定修改渠道商户号?', '提示', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning'
      }).then(() => {
        this.mchiddis = false
      }).catch(() => {
        this.$message({
          type: 'info',
          message: '已取消'
        });
      })
    },
    //显示添加标签弹框
    popuptag () {
      if (this.Channeldeploy1 === false) {
        this.usedTags = []
      }
      this.Channeldeploy1 = true
      //获取指定对象可添加标签
      getSelectTagsByRole({
        fid: this.merchantno,
        roleId: 5
      }).then(res => {
        if (res.code == 405) {
          sessionStorage.removeItem("token");
          this.$router.push("/login");
        } else if (res.code == 200) {
          if (this.unUsedTags.length == 0) {
            for (var i = 0; i < res.data.allTags.length; i++) {
              this.unUsedTags.push({ key: res.data.allTags[i].id, label: res.data.allTags[i].name })
            }
          }
          if (this.usedTags.length == 0) {
            for (var i = 0; i < res.data.usedTags.length; i++) {
              this.usedTags.push(res.data.usedTags[i].id)
            }
          }
        } else if (res.code == 500) {
          this.$message.error(res.message);
        }
      })
    },
    //获取指定对象已拥有的标签
    getdimensionTagList () {
      this.adm_tag = []
      this.cw_tag = []
      this.fws_tag = []
      getdimensionTagList({
        fid: this.merchantno,
        roleId: 5
      }).then(res => {
        if (res.code == 405) {
          sessionStorage.removeItem("token");
          this.$router.push("/login");
        } else if (res.code == 200) {
          // console.log(res)
          for (var i = 0; i < res.data.length; i++) {
            if (res.data[i].tagCreatorRole == 1 || res.data[i].tagCreatorRole == 8) {
              this.adm_tag.push({ key: res.data[i].id, label: res.data[i].tagName })
            } else if (res.data[i].tagCreatorRole == 9) {
              this.cw_tag.push({ key: res.data[i].id, label: res.data[i].tagName })
            } else if (res.data[i].tagCreatorRole == 2) {
              this.fws_tag.push({ key: res.data[i].id, label: res.data[i].tagName })
            }
          }
          // if(this.rolesId == 2){
          //   this.adm_tag = []
          //   this.cw_tag = []
          // }
        } else if (res.code == 500) {
          this.$message.error(res.message);
        }
      })
    },
    //给指定对象添加标签
    addLabel () {
      // console.log(this.usedTags.join(','))
      var data = this.usedTags.join(',')
      postDimensionTagSave({
        ids: data,
        fid: this.merchantno,
        roleId: 5,
        holder: this.merchantName
      }, this.merchantno).then(res => {
        if (res.code == 405) {
          sessionStorage.removeItem('token')
          this.$router.push('/login');
        } else if (res.code == 200) {
          this.$message({
            message: '添加成功',
            type: 'success'
          });
          this.Channeldeploy1 = false
          this.getdimensionTagList()
        } else if (res.code == 500) {
          this.Channeldeploy1 = true
          this.$message.error(res.message)
        }
      })
    },
    handleClose (id) {
      this.$confirm(`是否确定删除该标签？`, "提示", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning"
      }).then(() => {
        postDimensionTagRemove({}, id).then(res => {
          if (res.code == 405) {
            sessionStorage.removeItem('token')
            this.$router.push('/login');
          } else if (res.code == 200) {
            this.$message({
              message: '删除成功',
              type: 'success'
            });
            this.getdimensionTagList()
          } else if (res.code == 500) {
            this.$message.error(res.message);
          }
        })
      })
        .catch(() => {
          this.$message({
            type: "info",
            message: "已取消"
          });
        });
    },
    // 蓝海
    lanhai (id) {
      const loading = this.$loading({
        lock: true,
        text: 'Loading',
        spinner: 'el-icon-loading',
        background: 'rgba(0, 0, 0, 0.7)'
      });
      if (this.alilanhai == true) {
        // console.log(12)
        setBlueStatus({
          status: '2'
        }, id).then(res => {
          // console.log(res);
          if (res.code == 405) {
            sessionStorage.removeItem("token");
            this.$router.push("/login");
          } else if (res.code == 200) {
            this.$message({
              message: "开通成功",
              type: "success"
            });
            loading.close();
            this.merchantdetails();
          } else {
            this.$message.error(res.message);
            loading.close();
          }
        });
      } else if (this.alilanhai == false) {
        setBlueStatus({
          status: '0'
        }, id).then(res => {
          // console.log(res);
          if (res.code == 405) {
            sessionStorage.removeItem("token");
            this.$router.push("/login");
          } else if (res.code == 200) {
            this.$message({
              message: "已暂停",
              type: "success"
            });
            loading.close();
            this.merchantdetails();
          } else {
            this.$message.error(res.message);
            loading.close();
          }
        });
      }
    },
    // 绿洲
    lvzhou (id) {
      const loading = this.$loading({
        lock: true,
        text: 'Loading',
        spinner: 'el-icon-loading',
        background: 'rgba(0, 0, 0, 0.7)'
      });
      if (this.wecharlvzhou == true) {
        setGreenStatus({
          status: '2'
        }, id).then(res => {
          // console.log(res);
          if (res.code == 405) {
            sessionStorage.removeItem("token");
            this.$router.push("/login");
          } else if (res.code == 200) {
            this.$message({
              message: "开通成功",
              type: "success"
            });
            loading.close();
            this.merchantdetails();
          } else {
            this.$message.error(res.message);
            loading.close();
          }
        });
      } else if (this.wecharlvzhou == false) {
        setGreenStatus({
          status: '0'
        }, id).then(res => {
          // console.log(res);
          if (res.code == 405) {
            sessionStorage.removeItem("token");
            this.$router.push("/login");
          } else if (res.code == 200) {
            this.$message({
              message: "已暂停",
              type: "success"
            });
            loading.close();
            this.merchantdetails();
          } else {
            this.$message.error(res.message);
            loading.close();
          }
        });
      }

    },
    // 通道信息
    channleitem () {
      let _this = this
      // console.log(this.channelarr.wxChannelId,this.channelarr.aliChannelId,this.channelinfo)
      if (this.channelarr.wxChannelId) {
        let wxChannelId = this.channelinfo.filter(function (item) {
          return item.id == _this.channelarr.wxChannelId
        })
        // console.log(wxChannelId)
        this.wxchannelboxinfo = {
          wxchannelName: wxChannelId[0].channelName,
          wxmchId: wxChannelId[0].mchId,
          wxziMchId: wxChannelId[0].wxMchId,
        }
      }
      if (this.channelarr.aliChannelId) {
        let aliChannelId = this.channelinfo.filter(function (item) {
          return item.id == _this.channelarr.aliChannelId
        })
        // console.log(aliChannelId)
        this.alichannelboxinfo = {
          alichannelName: aliChannelId[0].channelName,
          alimchId: aliChannelId[0].mchId,
          aliziMchId: aliChannelId[0].aliSmid,
        }
      }
    },
    // 电子发票
    invoice () {
      this.bill = true;
    },
    // 获取总店
    allmerchantlist () {
      allmerchantlist({
        pid: '-1'
      }).then(res => {
        // console.log(res);
        if (res.code == 405) {
          sessionStorage.removeItem("token");
          this.$router.push("/login");
        } else if (res.code == 200) {
          // console.log(res)
          this.merarr = []
          for (var i = 0; i < res.data.rows.length; i++) {
            this.merarr.push({
              value: res.data.rows[i].merchantName,
              id: res.data.rows[i].id
            });
          }
        } else {
          this.$message.error(res.message);
        }
      });
    },
    // 总分店
    querySearch3 (queryString, cb) {
      let merarr = this.merarr;
      let results = queryString
        ? merarr.filter(this.createFilter(queryString))
        : merarr;
      // 调用 callback 返回建议列表的数据
      cb(results);
    },
    // 选取总店
    dianming (val) {
      this.setupshops.pid = val.id
    },
    // 打开总分店
    zonefendianbtn (id) {
      let that = this
      this.allmerchantlist()
      // console.log(id)
      chaindetail({
        id: id,
      }).then(res => {
        if (res.code == 200) {
          console.log(res)
          let data = res.data
          if (data.pid != '-1') {
            if (data.pid == '-1') {
              this.setupshops.type = '-1'
            } else {
              this.setupshops.type = '2'
              this.setupshops.pid = data.pid
            }
            this.setupshops.openTime = data.openTime
            this.setupshops.closeTime = data.closeTime
            this.setupshops.lines = data.limitFee
            this.setupshops.dianming = data.pName
            if (data.limitFee == 0) {
              this.setupshops.permissions = '2'
            } else {
              this.setupshops.permissions = '1'
            }
          }

        } else {
          that.$message.error(res.message);
        }

      });
      this.zongfendian = true

    },
    // 编辑总分店
    setupshopok () {
      let that = this;
      chainupdate({
        id: that.merchantinfo.id,
        openTime: that.setupshops.openTime,
        closeTime: that.setupshops.closeTime,
        limitFee: that.setupshops.lines,
        pid: that.setupshops.pid,
      }).then(res => {
        if (res.code == 200) {
          that.$message({
            message: "开通成功",
            type: "success"
          });
        } else {
          that.$message.error(res.message);
        }
        this.zongfendian = false;
        this.merchantdetails();
        this.setupshops = {
          type: '-1',
          openTime: '',
          closeTime: '',
          permissions: '',
          lines: '',
          pid: '-1',
          dianming: ''

        }
      });
    },
    // 关闭总门店
    chainclose (id) {
      let that = this;
      console.log(id)
      this.$confirm("是否确定关闭？", "提示", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning"
      })
        .then(() => {
          chainclose({
            id: id,
          }).then(res => {
            if (res.code == 200) {
              that.$message({
                message: "已关闭总分店模式",
                type: "success"
              });
              this.$router.push({
                path: "/mymerchants",
              });
              setTimeout(function () { that.$router.go(0) }, 200)
            } else {
              that.$message.error(res.message);
            }

          });
        })
        .catch(() => {
          this.$message({
            type: "info",
            message: "已取消"
          });
        });


    },
    // 打开分账
    openfenzhang (item) {
      this.fenzhang = true
      // this.chainsubs(item.channelType)
      this.channelType = item.channelType
      // 获取商户通道分账配置
      splitinfo({
        merchantId: this.merchantinfo.id,
        channelType: item.channelType,
      }).then(res => {
        // console.log(res);
        if (res.code == 405) {
          sessionStorage.removeItem("token");
          this.$router.push("/login");
        } else if (res.code == 200) {
          // console.log(res)
          if (res.data.splitList) {
            this.fenzhangData = res.data.splitList
          }

        } else {
          this.$message.error(res.message);
        }
      });
    },
    // 查询分账分店
    querySearch (queryString, cb) {
      let servicearr = this.servicearr;
      let results = queryString
        ? servicearr.filter(this.createFilter(queryString))
        : servicearr;
      // 调用 callback 返回建议列表的数据
      cb(results);
    },
    // 获取分店
    chainsubs (channelType) {
      chainsubs({
        id: this.merchantinfo.id,
        channelType: channelType,
        merchantName: '',
      }).then(res => {
        // console.log(res);
        if (res.code == 405) {
          sessionStorage.removeItem("token");
          this.$router.push("/login");
        } else if (res.code == 200) {
          // console.log(res)
          this.servicearr = []
          for (var i = 0; i < res.data.length; i++) {
            this.servicearr.push({
              value: res.data[i].merchantName,
              id: res.data[i].merchantId
            });
          }
        } else {
          this.$message.error(res.message);
        }
      });
    },
    serviceid (item) {
      console.log(item)
      this.mchId = item.id
    },
    createFilter (queryString) {
      return restaurant => {
        return (
          restaurant.value.toLowerCase().indexOf(queryString.toLowerCase()) !==
          -1
        );
      };
    },
    addfenzhang () {
      if (this.fenzhangs.name && this.fenzhangs.splitRate) {
        let farr = {
          merchantNo: this.fenzhangs.name,
          splitRate: this.fenzhangs.splitRate
        }
        this.fenzhangData.push(farr)
        this.fenzhangs = {}
      } else {
        this.$message.error('请确定分店商户和分店比例');
      }

    },
    // 确定分账配置
    splitconfigt () {
      let that = this

      axios.post(
        this.$store.state.url + "/product/v31/api/merchant/split/config",
        {
          merchantId: this.merchantinfo.id,
          channelType: this.channelType,
          splitList: this.fenzhangData,
        },
        {
          headers: {
            "Content-Type": "application/json",
            token: sessionStorage.getItem("token")
          }
        }
      )
        .then(function (res) {
          console.log(res)
          if (res.data.code == 405) {
            sessionStorage.removeItem("token");
            this.$router.push("/login");
          } else if (res.data.code == 200) {
            that.$message({
              message: "添加成功",
              type: "success"
            });
            that.fenzhang = false
          } else {
            that.$message.error(res.data.message);
          }
        })
    },
    // 开通分账
    splitopen (channelType) {
      splitopen({
        merchantId: this.merchantinfo.id,
        channelType: channelType,
      }).then(res => {
        // console.log(res);
        if (res.code == 405) {
          sessionStorage.removeItem("token");
          this.$router.push("/login");
        } else if (res.code == 200) {
          // console.log(res)
          this.$message({
            message: "开通成功",
            type: "success"
          });
          this.channel()
        } else {
          this.$message.error(res.message);
        }
      });
    },
    // 删除分账列表
    delfenzhang (id) {
      // 先找到
      const deleteIndex = this.fenzhangData.findIndex(item => {
        return item.merchantNo === id
      })
      // 再删除，`splice(开始下标， 删除元素数量)
      this.fenzhangData.splice(deleteIndex, 1)
    },
    //支付权限配置
    payjurisdiction () {
      paycfg({
        shopRefund: this.merchantinfo.shopRefund.toString(),
        aliSwitch: this.merchantinfo.aliSwitch.toString(),
        wxSwitch: this.merchantinfo.wxSwitch.toString(),
        uniSwitch: this.merchantinfo.uniSwitch.toString(),
        aliTradeSwitch: this.payinfo.aliborc + ',' + this.payinfo.alicorb + ',' + this.payinfo.alirefund,
        wxTradeSwitch: this.payinfo.wxborc + ',' + this.payinfo.wxcorb + ',' + this.payinfo.wxrefund,
        uniTradeSwitch: this.payinfo.uniborc + ',' + this.payinfo.unicorb + ',' + this.payinfo.unirefund,
        bankTradeSwitch: this.payinfo.bankborc + ',' + '0,' + this.payinfo.bankrefund,
      }, this.merchantinfo.id).then(res => {
        // console.log(res);
        if (res.code == 405) {
          sessionStorage.removeItem("token");
          this.$router.push("/login");
        } else if (res.code == 200) {
          // console.log(res)
          this.$message({
            message: "修改成功",
            type: "success"
          });
          this.jurisdiction = false
          this.merchantdetails()
        } else {
          this.$message.error(res.message);
        }
      });
    },
    // 代运营申请
    operationapply () {
      let that = this
      if (this.operationapplybtn) {
        this.operationapplybtn = false
        const loading = this.$loading({
          lock: true,
          spinner: 'el-icon-loading',
          background: 'rgba(0, 0, 0, 0.7)'
        });
        operationapply({
          merchantChannelId: this.merchantinfo.aliChannelId,
          alipayAccount: this.alipayAccount
        }).then(res => {
          if (res.code == 200) {
            this.batchNo = res.data.batchNo
            this.$message({
              message: "代申请成功",
              type: "success"
            });
            loading.close();
            this.threebinding = false
            setTimeout(function () {
              that.operationapplybtn = true
            }, 10000)
          } else {
            this.$message.error(res.message);
            loading.close();
            that.operationapplybtn = true
          }
        })
      } else {
        this.$message({
          message: '您操作过于频繁,请稍后再试',
          type: 'warning'
        });
      }

    },
    // 同步运营操作结果
    operationresult () {
      let that = this
      if (this.operationresultbtn) {
        this.operationresultbtn = false
        operationresult({
          merchantChannelId: this.merchantinfo.aliChannelId,
          batchNo: this.batchNo
        }).then(res => {
          if (res.code == 200) {
            this.$message({
              message: "同步成功",
              type: "success"
            });
            setTimeout(function () {
              that.operationresultbtn = true
            }, 10000)
          } else {
            this.$message.error(res.message);
            this.operationresultbtn = true
          }
        })
      } else {
        this.$message({
          message: '您操作过于频繁,请稍后再试',
          type: 'warning'
        });
      }

    },
    // 同步支付宝门店信息
    syncShop () {
      let that = this
      if (this.syncShopbtn) {
        this.syncShopbtn = false
        syncShop({
          merchantChannelId: this.merchantinfo.aliChannelId,
        }).then(res => {
          if (res.code == 200) {
            this.$message({
              message: "同步成功",
              type: "success"
            });
            setTimeout(function () {
              that.syncShopbtn = true
            }, 10000)
          } else {
            this.$message.error(res.message);
            that.syncShopbtn = true
          }
        })
      } else {
        this.$message({
          message: '您操作过于频繁,请稍后再试',
          type: 'warning'
        });
      }

    },
    // 新蓝海选择场景
    newlanhaitype (val) {
      this.newlanhaiinfo.applyMcc = ''
      this.newlanhaiinfo.licImageType = ''
      if (val == 1) {
        this.mcclist = [
          { name: '餐厅、订餐服务', id: '5812' },
          { name: '快餐店', id: '5814' },
          { name: '咖啡厅、茶馆', id: '5815' },
          { name: '面包糕点', id: '5462' },
          { name: '宴会提供商', id: '5811' },
          { name: '其他食品零售', id: '5499' },
          { name: '乳制品/冷饮', id: '5451' },
          { name: '水果店', id: '5423' },
          { name: '水果糖果及坚果商店', id: '5441' },
        ]
        this.materialslist = [
          { name: '营业执照', id: 'business_lic' },
          { name: '餐饮服务许可证', id: 'food_service_lic' },
          { name: '食品卫生许可证', id: 'food_health_lic' },
          { name: '食品经营许可证', id: 'food_business_lic' },
          { name: '食品流通许可证', id: 'food_circulate_lic' },
          { name: '食品生产许可证', id: 'food_production_lic' }
        ]
      } else if (val == 2) {
        this.mcclist = [
          { name: '杂货店', id: '5331' },
          { name: '超市，非平台类', id: '5411' },
          { name: '肉、禽、蛋及水产品', id: '5422' },
          { name: '其他食品零售', id: '5499' },
          { name: '母婴用品', id: '5641' },
          { name: '化妆品', id: '5977' },
          { name: '烟草/雪茄', id: '5993' },
        ]
        this.materialslist = [
          { name: '营业执照', id: 'business_lic' }
        ]
      }
    },
    // 监听新蓝海行业类目
    mccchange (val) {
      this.newlanhaiinfo.licImageType = ''
      if (val == '5499') {
        if (this.newlanhaiinfo.applyType == '1') {
          this.materialslist = [
            { name: '餐饮服务许可证', id: 'food_service_lic' },
            { name: '食品卫生许可证', id: 'food_health_lic' },
            { name: '食品经营许可证', id: 'food_business_lic' },
            { name: '食品流通许可证', id: 'food_circulate_lic' },
            { name: '食品生产许可证', id: 'food_production_lic' }
          ]
        } else if (this.newlanhaiinfo.applyType == '2') {
          this.materialslist = [
            { name: '营业执照', id: 'business_lic' }
          ]
        }
      } else if (val == '5993') {
        this.materialslist = [
          { name: '烟草专卖零售许可证', id: 'tobacco_lic' }
        ]
      }
    },
    // 确定新蓝海按钮
    newlanhaiok () {
      const loading = this.$loading({
        lock: true,
        spinner: 'el-icon-loading',
        background: 'rgba(0, 0, 0, 0.7)'
      });
      if (this.alilanhaival == 0) {
        blueSeaapply({
          channelId: this.merchantinfo.aliChannelId,
          provinceCode: this.newlanhaiinfo.selectedOptions[0],
          cityCode: this.newlanhaiinfo.selectedOptions[1],
          countyCode: this.newlanhaiinfo.selectedOptions[2],
          ...this.newlanhaiinfo
        }).then(res => {
          if (res.data.code == 200) {
            loading.close();
            this.$message({
              message: res.message,
              type: "success"
            });
            this.newlanhai = false
            this.merchantdetails()
          } else {
            loading.close();
            this.$message.error(res.message);
          }
        })
      } else if (this.alilanhaival == 4) {
        blueSeamodify({
          channelId: this.merchantinfo.aliChannelId,
          provinceCode: this.newlanhaiinfo.selectedOptions[0],
          cityCode: this.newlanhaiinfo.selectedOptions[1],
          countyCode: this.newlanhaiinfo.selectedOptions[2],
          ...this.newlanhaiinfo
        }).then(res => {
          if (res.data.code == 200) {
            loading.close();
            this.$message({
              message: res.message,
              type: "success"
            });
            this.merchantdetails()
          } else {
            loading.close();
            this.$message.error(res.message);
          }
        })
      }

    },
    logadings () {
      this.loadingss = this.$loading({
        lock: true,
        spinner: 'el-icon-loading',
        background: 'rgba(0, 0, 0, 0.7)'
      });
    },
    pOutside (res, file) { // 外部门头照
      if (res.code == 405) {
        this.loadingss.close();
        sessionStorage.removeItem("token");
        this.$router.push("/login");
      } else if (res.code == 200) {
        this.loadingss.close();
        this.$message({
          message: "上传成功",
          type: "success"
        });
        this.newlanhaiinfo.outsideUrl = res.data.filePath;
      } else {
        this.loadingss.close();
        this.$message.error(res.message);
      }
    },
    pInside (res, file) { // 内部环境照
      if (res.code == 405) {
        this.loadingss.close();
        sessionStorage.removeItem("token");
        this.$router.push("/login");
      } else if (res.code == 200) {
        this.loadingss.close();
        this.$message({
          message: "上传成功",
          type: "success"
        });
        this.newlanhaiinfo.insideUrl = res.data.filePath;
      } else {
        this.loadingss.close();
        this.$message.error(res.message);
      }
    },
    statusphoto (res, file) { // 资质证明材料
      if (res.code == 405) {
        this.loadingss.close();
        sessionStorage.removeItem("token");
        this.$router.push("/login");
      } else if (res.code == 200) {
        this.loadingss.close();
        this.$message({
          message: "上传成功",
          type: "success"
        });
        this.newlanhaiinfo.licImageUrl = res.data.filePath;
      } else {
        this.loadingss.close();
        this.$message.error(res.message);
      }
    },
    // 打开新蓝海弹窗
    newlanhaibtn (id) {
      this.newlanhaiinfo = {}
      let that = this
      this.newlanhai = true
      if (this.alilanhaival == 4) {
        this.newlanhaidisabled = true
      }
      blueSeaquery({
        channelId: this.merchantinfo.aliChannelId
      }).then(res => {
        console.log(res)
        this.newlanhaiinfo = {
          ...res.data,
          selectedOptions: [res.data.provinceCode, res.data.cityCode, res.data.countyCode],
        }
        if (res.data.applyType == 1) {
          this.mcclist = [
            { name: '餐厅、订餐服务', id: '5812' },
            { name: '快餐店', id: '5814' },
            { name: '咖啡厅、茶馆', id: '5815' },
            { name: '面包糕点', id: '5462' },
            { name: '宴会提供商', id: '5811' },
            { name: '其他食品零售', id: '5499' },
            { name: '乳制品/冷饮', id: '5451' },
            { name: '水果店', id: '5423' },
            { name: '水果糖果及坚果商店', id: '5441' },
          ]
          this.materialslist = [
            { name: '营业执照', id: 'business_lic' },
            { name: '餐饮服务许可证', id: 'food_service_lic' },
            { name: '食品卫生许可证', id: 'food_health_lic' },
            { name: '食品经营许可证', id: 'food_business_lic' },
            { name: '食品流通许可证', id: 'food_circulate_lic' },
            { name: '食品生产许可证', id: 'food_production_lic' }
          ]
        } else if (res.data.applyType == 2) {
          this.mcclist = [
            { name: '杂货店', id: '5331' },
            { name: '超市，非平台类', id: '5411' },
            { name: '肉、禽、蛋及水产品', id: '5422' },
            { name: '其他食品零售', id: '5499' },
            { name: '母婴用品', id: '5641' },
            { name: '化妆品', id: '5977' },
            { name: '烟草/雪茄', id: '5993' },
          ]
          this.materialslist = [
            { name: '营业执照', id: 'business_lic' }
          ]
        }

      })
    },
    // 省市区选择
    handleChange (value) {
      console.log(value)
    }

  }
};
</script>

<style scoped lang="less">
.title {
  background: #fff;
  padding: 10px;
  font-size: 18px;
  font-weight: 500;
  display: flex;
  justify-content: space-between;
}
.container {
  width: 100%;
  display: flex;
  margin-bottom: 20px;
  box-sizing: border-box;
  flex-wrap: wrap;
}
.container .itemBox {
  width: 50%;
}
.container .itemBox .line {
  width: 100%;
  display: flex;
  font-size: 14px;
  line-height: 200%;
}
.container .itemBox .line div:nth-child(1) {
  width: 30%;
  text-align: left;
}
.container .itemBox .line div:nth-child(2) {
  width: 70%;
  text-align: left;
  color: #888888;
}
.container .payBox {
  width: 100%;
}
.container .payBox .thead {
  border-bottom: 1px solid #dddddd;
  display: flex;
  padding-top: 15px;
}
.container .payBox .thead span {
  width: 25%;
  text-align: center;
  display: inline-block;
}
.container .payBox .tbody {
  display: flex;
  padding: 15px 0;
}
.container .payBox .tbody div {
  width: 25%;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  font-size: 13px;
}
.channel {
  display: flex;
  justify-content: flex-start;
  align-items: center;
  flex-wrap: wrap;
}
.channel .cBox {
  width: 14.8%;
  margin-right: 25px;
  margin-bottom: 25px;
}
.channel .cBox .channelitem {
  width: 100%;
  border: 1px solid #e9e9e9;
  border-radius: 8px;
  position: relative;
  padding: 20px 0;
  box-shadow: 5px 5px 5px #e9e9e9;
  &:hover {
    transform: scale(1.1);
  }
}

.channel .cBox .channelitem .line {
  display: flex;
  width: 100%;
  justify-content: center;
  align-items: center;
  margin: 10px 0;
  margin-top: 20px;
}
.delBtn {
  position: absolute;
  left: 5px;
  top: 5px;
}
.lines {
  display: flex;
  width: 100%;
  justify-content: center;
  align-items: center;
  height: 50px;
  .btn {
    div {
      color: #01aaef;
      border: 1px solid #01aaef;
      font-size: 14px;
      padding: 3px 6px;
      cursor: pointer;
    }
  }
}
.channel .cBox .channelitem .line img {
  width: 45px;
  height: 45px;
  margin-right: 10px;
  margin-bottom: 50px;
}
.channel .cBox .channelitem .state {
  position: absolute;
  top: 0;
  right: 0;
  text-align: center;
  color: #000;
  background: url(../../assets/img/pass.png) no-repeat;
  background-size: 100%;
  width: 80px;
  height: 80px;
  color: #fff;
  padding-top: 17px;
  span {
    margin-left: 25px;
    font-size: 13px;
  }
}
.channel .cBox .channelitem {
  .rejected {
    position: absolute;
    top: 0;
    right: 0;
    text-align: center;
    color: #000;
    background: url(../../assets/img/rejected.png) no-repeat;
    background-size: 100%;
    width: 80px;
    height: 80px;
    color: #fff;
    padding-top: 17px;
    span {
      margin-left: 25px;
      font-size: 13px;
    }
  }
  .passjia {
    position: absolute;
    top: 0;
    right: 0;
    text-align: center;
    color: #000;
    background: url(../../assets/img/passjia.png) no-repeat;
    background-size: 100%;
    width: 80px;
    height: 80px;
    color: #fff;
    padding-top: 17px;
    span {
      margin-left: 25px;
      font-size: 13px;
    }
  }
  .review {
    position: absolute;
    top: 0;
    right: 0;
    text-align: center;
    color: #000;
    background: url(../../assets/img/review.png) no-repeat;
    background-size: 100%;
    width: 80px;
    height: 80px;
    color: #fff;
    padding-top: 17px;
    cursor: pointer;
    span {
      margin-left: 25px;
      font-size: 13px;
    }
  }
}
.channel .cBox .tip {
  width: 100%;
  height: 70px;
  display: flex;
  justify-content: center;
  align-items: center;
  text-align: center;
  margin-top: 10px;
}
.channel .cBox .tip span {
  display: inline-block;
  width: 100%;
  text-align: center;
}
.el-icon-sort {
  color: #01aaef;
  font-size: 20px;
  -moz-transform: rotate(-90deg);
  -webkit-transform: rotate(-90deg);
  margin-left: 10px;
  font-weight: 600;
}
.tbodystate {
  background: #f0f0f0;
  color: #ff9800;
  margin-left: 10px;
  padding: 5px;
}
.project {
  width: 10%;
}
.project .projectitem {
  display: flex;
  width: 100%;
  justify-content: center;
  align-items: center;
}
.project .tip {
  width: 100%;
  text-align: center;
  margin-top: 10px;
}
.bule {
  color: #409eff;
  text-decoration: underline;
  cursor: pointer;
}
.operbtn {
  color: #409eff;
  text-decoration: underline;
  cursor: pointer;
  text-align: center;
}
.error span {
  background: #f0f0f0;
  color: #f9607d;
}
.error {
  color: #f9607d;
  cursor: pointer;
}
.red {
  color: red;
  text-decoration: underline;
}
.reds {
  color: red;
  font-size: 20px;
  width: 100%;
  padding: 5px 15px;
  text-align: left;
}
.blueBtn {
  background: #3794ec;
  color: #fff;
  padding: 3px 20px;
  border-radius: 30px;
  cursor: pointer;
}
.open {
  color: #92cd92;
}

.flex {
  width: 100%;
  margin-top: 20px;
  display: flex;
  justify-content: flex-start;
  align-items: center;
}
.urllist {
  width: 60%;
  margin: 0 auto;
}
.itemtit {
  font-size: 15px;
  font-weight: 600;
  margin-right: 30px;
}
.alibox {
  width: 100%;
  // padding: 0 10%;
  margin-top: 25px;
}
#qrcode img {
  width: 200px;
  height: 200px;
}
.servicelevel {
  width: 100%;
}
.servicelevels {
  width: 97%;
}
.wid50 {
  width: 60% !important;
}
.wid50-2 {
  width: 25% !important;
}
.head {
  cursor: pointer;
}
.signingcode {
  width: 100%;
  text-align: center;
}
.el_tag {
  margin-right: 10px;
  margin-bottom: 5px;
}
.border {
  border-top: 1px solid #eeeeee;
  margin-top: 5px;
}
.pay-form-inline {
  margin-bottom: 8px;
}
.width100 {
  width: 95%;
}
.photo {
  width: 50%;
  display: inline-block;
}
.marv {
  margin: 5px 0;
  width: 100% !important;
}
</style>
